8000 gh-117953: Cleanups For fix_up_extension() in import.c by ericsnowcurrently · Pull Request #118192 · python/cpython · GitHub
[go: up one dir, main page]

Skip to content

gh-117953: Cleanups For fix_up_extension() in import.c #118192

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

Merged
Merged
Changes from 1 commit
Commits
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
Next Next commit
fix_up_extension() -> update_global_state_for_extension()
  • Loading branch information
ericsnowcurrently committed Apr 23, 2024
commit 49760890beec60dff8b07485d36ca33bfb982387
17 changes: 12 additions & 5 deletions Python/import.c
Original file line number Diff line number Diff line change
Expand Up @@ -1173,8 +1173,9 @@ is_core_module(PyInterpreterState *interp, PyObject *name, PyObject *path)


static int
fix_up_extension(PyThreadState *tstate, PyObject *mod, PyModuleDef *def,
PyObject *name, PyObject *path)
update_global_state_for_extension(PyThreadState *tstate,
PyObject *mod, PyModuleDef *def,
PyObject *name, PyObject *path)
{
assert(mod != NULL && PyModule_Check(mod));
assert(def == _PyModule_GetDef(mod));
Expand Down Expand Up @@ -1254,7 +1255,9 @@ _PyImport_FixupExtensionObject(PyObject *mod, PyObject *name,
}

PyThreadState *tstate = _PyThreadState_GET();
if (fix_up_extension(tstate, mod, def, name, filename) < 0) {
if (update_global_state_for_extension(
tstate, mod, def, name, filename) < 0)
{
return -1;
}
if (finish_singlephase_extension(tstate, mod, def, name, modules) < 0) {
Expand Down Expand Up @@ -1390,7 +1393,9 @@ _PyImport_FixupBuiltin(PyThreadState *tstate, PyObject *mod, const char *name,
goto finally;
}

if (fix_up_extension(tstate, mod, def, nameobj, nameobj) < 0) {
if (update_global_state_for_extension(
tstate, mod, def, nameobj, nameobj) < 0)
{
goto finally;
}
if (finish_singlephase_extension(tstate, mod, def, nameobj, modules) < 0) {
Expand Down Expand Up @@ -1466,7 +1471,9 @@ create_builtin(PyThreadState *tstate, PyObject *name, PyObject *spec)
/* Remember pointer to module init function. */
def->m_base.m_init = p0;

if (fix_up_extension(tstate, mod, def, name, name) < 0) {
if (update_global_state_for_extension(
tstate, mod, def, name, name) < 0)
{
return NULL;
}
PyObject *modules = get_modules_dict(tstate, true);
Expand Down
0