This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author cryvate
Recipients cryvate
Date 2017-12-01.00:10:50
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1512087050.24.0.213398074469.issue32188@psf.upfronthosting.co.za>
In-reply-to
Content
ImpImporter.find_modules calls os.path.real on the path used:

https://github.com/python/cpython/blob/be6b74c0795b709c7a04e2187a7e32d08f5155f6/Lib/pkgutil.py#L181

This means if there is a submodule (foo.bar) which first appears on the path involving a symlink that

pkgutil.find_loader('foo').get_filename()

has the path with the symlinks removed whereas

import foo
foo.__file__

does have the symlinks. Note that is in the absence of any PEP302 import hooks.

This behaviour comes up in pytest test/plugin collection in virtual environments in Py2.7 on linux where they have a symlinked venv/local/lib before venv/lib on the path and creates problems.

There might very well be a good reason the path is made absolute here, however the test suite passes when it is reverted to path = [self.path].
History
Date User Action Args
2017-12-01 00:10:50cryvatesetrecipients: + cryvate
2017-12-01 00:10:50cryvatesetmessageid: <1512087050.24.0.213398074469.issue32188@psf.upfronthosting.co.za>
2017-12-01 00:10:50cryvatelinkissue32188 messages
2017-12-01 00:10:50cryvatecreate