[issue34572] C unpickling bypasses import thread safety

Eric Snow report at bugs.python.org
Thu Feb 7 11:39:48 EST 2019


Eric Snow <ericsnowcurrently at gmail.com> added the comment:

Perhaps PyImport_GetModule() should aquire-release the module's lock before the lookup?  This would effectively be a call to _lock_unlock_module() in importlib._bootstrap.

The alternative is to encourage using PyImport_Import() instead, like the PR has done.  In the case the docs for PyImport_GetModule() should make it clear that it is guaranteed that the module is fully imported yet (and recommend using PyImport_Import() for the guarantee).

Either way there should be a new issue for the more general change (and it should reference this issue).

----------
type: crash -> behavior

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


More information about the Python-bugs-list mailing list