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
bb-migration opened this Issue May 2, 2015 · 3 comments

Comments

Projects
None yet
2 participants
@bb-migration

bb-migration 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.


@bb-migration

This comment has been minimized.

bb-migration commented May 28, 2015

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


Fixed in 6f91e08f283f1822c16b4bafdee73cd30da56794.

@bb-migration

This comment has been minimized.

bb-migration commented May 28, 2015

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


Thanks!

@jayvdb

This comment has been minimized.

Contributor

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.

takluyver added a commit to takluyver/pip that referenced this issue Apr 13, 2017

Include newer setuptools for tests
Old version of setuptools it was using had a bug on Python 3.6
pypa/setuptools#378
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment