Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove dependency on imp. #857

Merged
merged 1 commit into from
Dec 13, 2020
Merged

Remove dependency on imp. #857

merged 1 commit into from
Dec 13, 2020

Conversation

pkolbus
Copy link
Contributor

@pkolbus pkolbus commented Nov 22, 2020

Steps

  • For new features or bug fixes, add a ChangeLog entry describing what your PR does.
  • Write a good description on what the PR does.

Description

Removes all usage of the imp module, which has been deprecated since python 3.4.

This is a continuation of @degustaf's excellent work in #686. I've rebased, addressed review comments from that PR, fixed pylint warnings, and implemented the solution for modutils as discussed in #686.

The test_qqch test is removed as it seems to behave differently depending on whether modutils imports anything from stdlib, and it’s not clear what the objective of that test actually is.

Type of Changes

Type
🐛 Bug fix

Related Issue

Closes #594 and #681

@pkolbus
Copy link
Contributor Author

pkolbus commented Nov 27, 2020

This is now ready for review.

@hippo91 hippo91 self-assigned this Nov 29, 2020
Copy link
Contributor

@hippo91 hippo91 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@pkolbus thank you very much for this PR.
I just need some explanations about the test_qqch deletion. Otherwise it's all good for me.
By the way thanks also to @degustaf !

@@ -541,18 +541,6 @@ class Warning(Warning):
self.assertEqual(ancestor.root().name, BUILTINS)
self.assertRaises(StopIteration, partial(next, ancestors))

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree these test is not specially clear, but i do not understand why do you delete it. Can you explain a little bit more?

@pkolbus
Copy link
Contributor Author

pkolbus commented Dec 12, 2020

@pkolbus thank you very much for this PR.

I just need some explanations about the test_qqch deletion. Otherwise it's all good for me.

By the way thanks also to @degustaf !

You're welcome!

The test_qqch deletion is summarized in the PR description. The test now gives different results on Python 3.8 and earlier versions. Oddly, simply re-adding the import imp to modutils changes the result, so the fact that it worked before seemed accidental and fragile. And it's not clear to me from the test name or the repository history what this is aiming to cover or why.

If you think the deletion is a problem and can offer any clues about the intent of the test, I'd be happy to re-add it, or an equivalent.

@hippo91
Copy link
Contributor

hippo91 commented Dec 13, 2020

@pkolbus i investigated a bit this unit test. With current master (i.e using imp module) the inferred value for xxx node is [Uninferable, <Const.NoneType l.236 at 0x7f601f5c5050>, <Const.NoneType l.326 at 0x7f601f801ad0>]. Thus even with the current implementation this import is not inferred precisely.
The first NoneType comes from the function load_module_from_modpath (probably line 236). This one doesn't exist any more with your implementation because this function has been considerably redefined.
The second NoneType comes from the imp module itself.
Thus IMHO this unit test doesn't means anything anymore. Let's remove it.

@hippo91 hippo91 merged commit 969a5cf into pylint-dev:master Dec 13, 2020
@pkolbus pkolbus deleted the remove-imp branch December 13, 2020 12:07
@pkolbus
Copy link
Contributor Author

pkolbus commented Dec 13, 2020

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Move away from imp
2 participants