Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

gh-117953: Refactor Import Machinery Code for Extension Modules #118116

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

Closed
Changes from 1 commit
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
cc67849
Factor out _PyImport_RunDynamicModule().
ericsnowcurrently Feb 8, 2024
2e5ecde
Drop _PyImport_LoadDynamicModuleWithSpec().
ericsnowcurrently Feb 8, 2024
b810cd8
Add an assert.
ericsnowcurrently Feb 8, 2024
8d0ef38
Factor out fix_up_extension_for_interpreter().
ericsnowcurrently Feb 8, 2024
7f930cc
Do _extensions_cache_set() first.
ericsnowcurrently Feb 8, 2024
1ffeaef
Calculate path_bytes ahead of time.
ericsnowcurrently Apr 16, 2024
7500285
Move the audit entry to _imp_create_dynamic_impl().
ericsnowcurrently Apr 16, 2024
3c0b170
_Py_ext_module_loader_info_from_spec() -> _Py_ext_module_loader_info_…
ericsnowcurrently Apr 16, 2024
02e24cc
Add info.newcontext.
ericsnowcurrently Apr 16, 2024
ba5ffa7
Split up _PyImport_RunDynamicModule() along cross-interpreter-safe bo…
ericsnowcurrently Apr 16, 2024
b895966
Drop _PyImport_RunDynamicModule().
ericsnowcurrently Apr 16, 2024
76fa273
Always close the file handle.
ericsnowcurrently Apr 16, 2024
1e936c5
Revert the fclose() change.
ericsnowcurrently Apr 16, 2024
6bb07b9
Factor out create_dynamic().
ericsnowcurrently Apr 16, 2024
2705e65
Drop _PyImport_FixupExtensionObject().
ericsnowcurrently Apr 16, 2024
98d8b4b
Move setting __file__ to fix_up_extension().
ericsnowcurrently Apr 17, 2024
ddf1135
Pass tstate through to fix_up_extension().
ericsnowcurrently Apr 17, 2024
694a763
Add a note about _PyImport_FixupBuiltin().
ericsnowcurrently Apr 17, 2024
72e0d73
Always expect a valid modules dict passed to fix_up_extension().
ericsnowcurrently Apr 17, 2024
3f14a67
Factor out reload_singlephase_extension().
ericsnowcurrently Apr 17, 2024
b5f5868
res.singlephase -> res.kind
ericsnowcurrently Apr 17, 2024
a5f7535
Factor out _extensions_cache_init().
ericsnowcurrently Apr 17, 2024
e8d674a
Factor out _extensions_cache_find_unlocked().
ericsnowcurrently Apr 17, 2024
27b365d
Use _PyImport_RunModInitFunc() in create_builtin().
ericsnowcurrently Apr 18, 2024
5128702
Clean up _PyImport_FixupBuiltin().
ericsnowcurrently Apr 18, 2024
aaec360
Add some asserts to _PyImport_RunModInitFunc().
ericsnowcurrently Apr 18, 2024
f97671e
Drop the replace arg to _extensions_cache_set().
ericsnowcurrently Apr 18, 2024
2366983
Check the module returned by import_find_extension() to ensure single…
ericsnowcurrently Apr 18, 2024
d5039ea
Allow mod->md_def to be NULL.
ericsnowcurrently Apr 19, 2024
67d217b
Call _PyImport_RunModInitFunc() in reload_singlephase_extension().
ericsnowcurrently Apr 19, 2024
9e40287
res->err is an array, not just a pointer.
ericsnowcurrently Apr 19, 2024
b8c2a1d
Factor out import_run_extension() (and drop create_dynamic()).
ericsnowcurrently Apr 18, 2024
967c649
Factor out update_extension_cache() and drop fix_up_extension_for_int…
ericsnowcurrently Apr 19, 2024
aecf56c
We already know the def is okay.
ericsnowcurrently Apr 19, 2024
0d03d23
Revive fix_up_extension_for_interpreter().
ericsnowcurrently Apr 19, 2024
cace102
Add a distinct _Py_ext_module_loader_info.path (and old path -> filen…
ericsnowcurrently Apr 19, 2024
3cf0db0
Do not call update_extensions_cache() in fix_up_extension().
ericsnowcurrently Apr 19, 2024
9b3088a
Let the modules arg to fix_up_extension_for_interpreter() be NULL.
ericsnowcurrently Apr 19, 2024
4ac1644
Let the caller of update_extensions_cache() decide if m_copy should b…
ericsnowcurrently Apr 19, 2024
393a177
Fix the update_extensions_cache() signature.
ericsnowcurrently Apr 19, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Fix the update_extensions_cache() signature.
  • Loading branch information
ericsnowcurrently committed Apr 19, 2024
commit 393a177e8e3730852f99667b320ec497fea8c054
8 changes: 4 additions & 4 deletions 8 Python/import.c
Original file line number Diff line number Diff line change
Expand Up @@ -1212,8 +1212,8 @@ struct cached_singlephase_info {
};

static int
update_extensions_cache(PyThreadState *tstate, PyModuleDef *def,
PyObject *path, PyObject *name,
update_extensions_cache(PyThreadState *tstate,
PyObject *path, PyObject *name, PyModuleDef *def,
struct cached_singlephase_info *singlephase)
{
/* Copy the module's __dict__, if applicable. */
Expand Down Expand Up @@ -1523,7 +1523,7 @@ import_run_extension(PyThreadState *tstate, PyModInitFunction p0,
assert(singlephase.m_dict != NULL);
}
if (update_extensions_cache(
tstate, def, info->path, info->name, &singlephase) < 0)
tstate, info->path, info->name, def, &singlephase) < 0)
{
Py_CLEAR(mod);
goto finally;
Expand Down Expand Up @@ -1584,7 +1584,7 @@ _PyImport_FixupBuiltin(PyThreadState *tstate, PyObject *mod, const char *name,
.m_dict=NULL,
};
if (update_extensions_cache(
tstate, def, nameobj, nameobj, &singlephase) < 0)
tstate, nameobj, nameobj, def, &singlephase) < 0)
{
goto finally;
}
Expand Down
Morty Proxy This is a proxified and sanitized view of the page, visit original site.