New submission from Cory Nezin <cory.ne...@gmail.com>:

As demonstrated in this Stack Overflow question 
(https://stackoverflow.com/questions/59377661/python-pkgutil-get-data-disrupts-future-imports)
 using `pkgutil.get_data` on a module causes future imports of children modules 
to fail.  I tracked this down to a call to `importlib._bootstrap.load` here: 
https://github.com/python/cpython/blob/3.8/Lib/pkgutil.py#L627

This seems to do something to sys.modules which I don't quite understand but I 
think it is caching the module when it shouldn't be.  If I replace the linked 
line with `importlib.import_module(package))` it seems to work okay.

----------
components: Library (Lib)
files: pkgutil_err.tar
messages: 375149
nosy: cnezin
priority: normal
severity: normal
status: open
title: `pkgutil.get_data` causes future imports of children modules to fail.
type: behavior
versions: Python 3.6, Python 3.7, Python 3.8
Added file: https://bugs.python.org/file49381/pkgutil_err.tar

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue41519>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to