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

Importing astroid issues a DeprecationWarning #681

Closed
pquentin opened this issue Jul 1, 2019 · 2 comments
Closed

Importing astroid issues a DeprecationWarning #681

pquentin opened this issue Jul 1, 2019 · 2 comments
Labels

Comments

@pquentin
Copy link

pquentin commented Jul 1, 2019

Steps to reproduce

Import astroid.

Current behavior

There's a DeprecationWarning:

$ python -W error -c 'import astroid'
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "../astroid/__init__.py", line 63, in <module>
    from astroid.nodes import *
  File "../astroid/nodes.py", line 23, in <module>
    from astroid.node_classes import (
  File "../astroid/node_classes.py", line 38, in <module>
    from astroid import bases
  File "../astroid/bases.py", line 33, in <module>
    MANAGER = manager.AstroidManager()
  File "../astroid/util.py", line 26, in <lambda>
    lambda: importlib.import_module("." + module_name, "astroid")
  File ".../importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "../astroid/manager.py", line 24, in <module>
    from astroid.interpreter._import import spec
  File "../astroid/interpreter/_import/spec.py", line 12, in <module>
    import imp
  File ".../imp.py", line 33, in <module>
    DeprecationWarning, stacklevel=2)
DeprecationWarning: the imp module is deprecated in favour of importlib; see the module's documentation for alternative uses
$ 

We've been using -W error to run the trio test suite for a long time, but this warning only became an issue when migrating trio to pytest 5 which has changes related to warnings.

Expected behavior

No warning:

$ python -W error -c 'import astroid'
$ 

python -c "from astroid import __pkginfo__; print(__pkginfo__.version)" output

2.2.5

Thank you!

@PCManticore
Copy link
Contributor

Thanks for the report! We had #594 for moving away from imp to something like importlib but it fell off the radar for some time. This means we definitely need to prioritize the switch sooner.

@hippo91
Copy link
Contributor

hippo91 commented Dec 13, 2020

I close this issue because it should have been solved thanks to #857.

@hippo91 hippo91 closed this as completed Dec 13, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants