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

Update imp to importlib for py3 #574

Merged
merged 3 commits into from
Feb 21, 2024

Conversation

jccurtis
Copy link

imp was deprecated in py36. While this package is not needed in most py3 packages after Jan2020, there still are some which maintain py27 support and this DeprecationWarning pops up. I think I covered all cases in the src tree. There are 2 (AFAIK) locations elsewhere (examples and docs) that use from imp import reload. I did not patch these.

Closes #488

@jccurtis
Copy link
Author

python36/37 are failing for some tests which may have to do with the reload behavior between imp and importlib but I haven't dug into this yet. Any thoughts?

if sys.version_info >= (3, 6):
import importlib as imp
else:
import imp
imp.reload(imp)
Copy link
Author

Choose a reason for hiding this comment

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

I wonder if this is causing the CI failure.

@alanyee
Copy link

alanyee commented Sep 30, 2020

According to docs, the module has been deprecated since 3.4 with certain methods deprecated since 3.3. Looking at specific methods such as https://docs.python.org/3/library/imp.html#imp.find_module, you might not be able to do a blanket alias and have to do specific imports.

@edschofield edschofield merged commit 6babd20 into PythonCharmers:master Feb 21, 2024
8 of 9 checks passed
@edschofield
Copy link
Contributor

Thanks @jccurtis !

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

Successfully merging this pull request may close these issues.

deprecation warning importing imp
3 participants