From: Victor Stinner Date: Mon, 15 Jun 2026 10:23:04 +0000 (+0200) Subject: gh-139227: Remove unused _PyRuntime.imports.pkgcontext (#151490) X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=552ce57e33ccb83c9e31cba1075f60c9364612a2;p=thirdparty%2FPython%2Fcpython.git gh-139227: Remove unused _PyRuntime.imports.pkgcontext (#151490) The global variable has been replaced by a new thread local variable "pkgcontext" in Python/import.c. --- diff --git a/Include/internal/pycore_interp_structs.h b/Include/internal/pycore_interp_structs.h index 956fa290f0ad..5500c70a3b0a 100644 --- a/Include/internal/pycore_interp_structs.h +++ b/Include/internal/pycore_interp_structs.h @@ -308,8 +308,6 @@ struct _import_runtime_state { Modules are added there and looked up in _imp.find_extension(). */ struct _Py_hashtable_t *hashtable; } extensions; - /* Package context -- the full module name for package imports */ - const char * pkgcontext; }; struct _import_state { diff --git a/Python/import.c b/Python/import.c index 42bfe15121f8..6da6faf5f28c 100644 --- a/Python/import.c +++ b/Python/import.c @@ -81,8 +81,6 @@ static struct _inittab *inittab_copy = NULL; #define LAST_MODULE_INDEX _PyRuntime.imports.last_module_index #define EXTENSIONS _PyRuntime.imports.extensions -#define PKGCONTEXT (_PyRuntime.imports.pkgcontext) - /*******************************/ /* interpreter import state */ @@ -883,7 +881,6 @@ _PyImport_ClearModulesByIndex(PyInterpreterState *interp) */ static _Py_thread_local const char *pkgcontext = NULL; -# undef PKGCONTEXT # define PKGCONTEXT pkgcontext const char *