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

pkg_resources relies on an internal implementation detail of CPython #378

Closed
ghost opened this issue May 2, 2015 · 3 comments
Closed

pkg_resources relies on an internal implementation detail of CPython #378

ghost opened this issue May 2, 2015 · 3 comments
Labels

Comments

@ghost
Copy link

@ghost ghost commented May 2, 2015

Originally reported by: ericsnowcurrently (Bitbucket: ericsnowcurrently, GitHub: ericsnowcurrently)


See https://bitbucket.org/pypa/setuptools/src/da9a12631950997e178e9bea1f2e6bb5859b214e/pkg_resources/__init__.py?at=default#cl-78.

Apparently pkg_resources is importing importlib._bootstrap, which is not meant to be directly imported. It is used later to get SourceFileLoader and FileFinder. I noticed this due to a failing test (test_venv) in the CPython suite when I moved both those classes to a different file (no longer in _bootstrap.py). See http://bugs.python.org/issue23911.

Starting in Python 3.3 the two classes are exposed in importlib.machinery. I'd recommend updating the code to look something like this:

if sys.version_info >= (3, 3) and sys.implementation.name == "cpython":
    from importlib.machinery import SourceFileLoader, FileFinder
else:
    SourceFileLoader = FileFinder = None

and update the rest of the file (3 spots) accordingly.


@ghost
Copy link
Author

@ghost ghost commented May 28, 2015

Original comment by arfrever (Bitbucket: arfrever, GitHub: arfrever):


Fixed in 6f91e08f283f1822c16b4bafdee73cd30da56794.

@ghost
Copy link
Author

@ghost ghost commented May 28, 2015

Original comment by ericsnowcurrently (Bitbucket: ericsnowcurrently, GitHub: ericsnowcurrently):


Thanks!

@ghost ghost added major bug labels Mar 29, 2016
@ghost ghost closed this Mar 29, 2016
@jayvdb
Copy link
Contributor

@jayvdb jayvdb commented Feb 16, 2017

This was fixed in 75d108c , and as far as I can tell, that means 17.0 is the first version of setuptools which works on Python 3.6.

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
1 participant