[issue13487] inspect.getmodule fails when module imports change sys.modules

Gregory P. Smith report at bugs.python.org
Wed Mar 4 19:50:55 EST 2020


Gregory P. Smith <greg at krypto.org> added the comment:

Testing by changing list(sys.modules.items()) to sys.modules.copy().items() internally with a large integration test that was reliably flaky on this line before shows that the .copy().items() worked.  The test is reliable again.

So I've gone ahead and pushed those changes in.  PyDict_Copy()'s implementation at first ~5 minute glance did not appear to have calls to code I'd expect to re-enter Python releasing the GIL.  But I didn't try to do a deep dive.  It works for us and is logically equivalent.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue13487>
_______________________________________


More information about the Python-bugs-list mailing list