]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
gh-139227: Remove unused _PyRuntime.imports.pkgcontext (#151490)
authorVictor Stinner <vstinner@python.org>
Mon, 15 Jun 2026 10:23:04 +0000 (12:23 +0200)
committerGitHub <noreply@github.com>
Mon, 15 Jun 2026 10:23:04 +0000 (10:23 +0000)
The global variable has been replaced by a new thread local variable
"pkgcontext" in Python/import.c.

Include/internal/pycore_interp_structs.h
Python/import.c

index 956fa290f0ad0e73538bbb8bdf58e5d78d341da6..5500c70a3b0aad91147f3309db15b6ea50b27b1b 100644 (file)
@@ -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 {
index 42bfe15121f84f78f1243e21573fedcf9da15ab7..6da6faf5f28cc3b7f9f91622a83344a74babdb76 100644 (file)
@@ -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 *