-
-
Notifications
You must be signed in to change notification settings - Fork 32.2k
bpo-33128 Fix duplicated call to importlib._install_external_importers #6273
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Python/pylifecycle.c
Outdated
@@ -345,20 +345,6 @@ initimport(PyInterpreterState *interp, PyObject *sysmod) | |||
return _Py_INIT_OK(); | |||
} | |||
|
|||
static _PyInitError |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This needs to stay - the bug is that initimport
is trying to install the external importers that rely on sys.path
(et al) already being configured properly.
test.sh
Outdated
@@ -0,0 +1,3 @@ | |||
./configure |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I suspect you didn't mean to check this in :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Woooops! 🙃
@ncoghlan I have removed the call from |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The change itself looks good to me now. The last item we need is a NEWS entry, as described in https://devguide.python.org/committing/#what-s-new-and-news-entries, which can be created using the blurb tool at https://pypi.org/project/blurb/
Alternatively, just comment below and I can add a suitable blurb entry for you (that may take a bit longer, though)
@ncoghlan I have added the News entry. Thanks for reviewing! |
Thanks @pablogsal for the PR, and @ncoghlan for merging it 🌮🎉.. I'm working now to backport this PR to: 3.7. |
GH-6592 is a backport of this pull request to the 3.7 branch. |
pythonGH-6273) External importers were being added in both phases of the import system initialisation. They're only supposed to be added in the second phase, after the import machinery has been appropriately configured. (cherry picked from commit 0977091) Co-authored-by: Pablo Galindo <Pablogsal@gmail.com>
GH-6273) External importers were being added in both phases of the import system initialisation. They're only supposed to be added in the second phase, after the import machinery has been appropriately configured. (cherry picked from commit 0977091) Co-authored-by: Pablo Galindo <Pablogsal@gmail.com>
https://bugs.python.org/issue33128
It seems that in 1abcf67
_Py_InitializeEx_Private
calls_Py_InitializeCore
and_Py_InitializeMainInterpreter
. The first one calls at the endinitimport
that in turns callsimportlib._install_external_importers
that sets thePathFinder
insys.meta_path
. Then,_Py_InitializeMainInterpreter
callsinitexternalimport
that in turns calls againimportlib._install_external_importers
and therefore we end with twoPathFinders
insys.meta_path
.This PR eliminates duplicated calls to
importlib._install_external_importers
.