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 pitrou
Recipients alexandre.vassalotti, brett.cannon, eric.snow, ncoghlan, pitrou, tjb900
Date 2019-02-08.17:09:57
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
I agree that more generally PyImport_GetModule() should be fixed.  But it should be done carefully so as to not to lose the performance benefit of doing it.  I think we should open a separate issue about that.

PS: one possibility is to reuse the optimization already done in PyImport_ImportModuleLevelObject():

        /* Optimization: only call _bootstrap._lock_unlock_module() if
           __spec__._initializing is true.
           NOTE: because of this, initializing must be set *before*
           stuffing the new module in sys.modules.
        spec = _PyObject_GetAttrId(mod, &PyId___spec__);
        if (_PyModuleSpec_IsInitializing(spec)) {
            PyObject *value = _PyObject_CallMethodIdObjArgs(interp->importlib,
                                            &PyId__lock_unlock_module, abs_name,
            if (value == NULL) {
                goto error;
Date User Action Args
2019-02-08 17:09:58pitrousetrecipients: + pitrou, brett.cannon, ncoghlan, alexandre.vassalotti, eric.snow, tjb900
2019-02-08 17:09:57pitrousetmessageid: <>
2019-02-08 17:09:57pitroulinkissue34572 messages
2019-02-08 17:09:57pitroucreate