mirror of
https://github.com/python/cpython
synced 2026-09-29 12:10:30 +03:00
gh-117953: Split Up _PyImport_LoadDynamicModuleWithSpec() (gh-118203)
Basically, I've turned most of _PyImport_LoadDynamicModuleWithSpec() into two new functions (_PyImport_GetModInitFunc() and _PyImport_RunModInitFunc()) and moved the rest of it out into _imp_create_dynamic_impl(). There shouldn't be any changes in behavior. This change makes some future changes simpler. This is particularly relevant to potentially calling each module init function in the main interpreter first. Thus the critical part of the PR is the addition of _PyImport_RunModInitFunc(), which is strictly focused on running the init func and validating the result. A later PR will take it a step farther by capturing error information rather than raising exceptions. FWIW, this change also helps readers by clarifying a bit more about what happens when an extension/builtin module is imported.
This commit is contained in:
parent
23d0371bb9
commit
44f57a952e
5 changed files with 193 additions and 145 deletions
|
|
@ -53,7 +53,7 @@ typedef struct PyModuleDef_Base {
|
|||
/* A copy of the module's __dict__ after the first time it was loaded.
|
||||
This is only set/used for legacy modules that do not support
|
||||
multiple initializations.
|
||||
It is set by _PyImport_FixupExtensionObject(). */
|
||||
It is set by fix_up_extension() in import.c. */
|
||||
PyObject* m_copy;
|
||||
} PyModuleDef_Base;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue