https://github.com/python/cpython/commit/552ce57e33ccb83c9e31cba1075f60c9364612a2
commit: 552ce57e33ccb83c9e31cba1075f60c9364612a2
branch: main
author: Victor Stinner <[email protected]>
committer: vstinner <[email protected]>
date: 2026-06-15T10:23:04Z
summary:

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.

files:
M Include/internal/pycore_interp_structs.h
M Python/import.c

diff --git a/Include/internal/pycore_interp_structs.h 
b/Include/internal/pycore_interp_structs.h
index 956fa290f0ad0e..5500c70a3b0aad 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 42bfe15121f84f..6da6faf5f28cc3 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 *

_______________________________________________
Python-checkins mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3//lists/python-checkins.python.org
Member address: [email protected]

Reply via email to