New submission from Henk-Jaap Wagenaar <wagenaarhenkj...@gmail.com>:
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]. ---------- components: Library (Lib) messages: 307353 nosy: Henk-Jaap Wagenaar priority: normal severity: normal status: open title: ImpImporter.find_modules removes symlinks in paths type: behavior versions: Python 2.7, Python 3.6, Python 3.7 _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue32188> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com