From 552ce57e33ccb83c9e31cba1075f60c9364612a2 Mon Sep 17 00:00:00 2001 From: Victor Stinner Date: Mon, 15 Jun 2026 12:23:04 +0200 Subject: [PATCH] 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. --- Include/internal/pycore_interp_structs.h | 2 -- Python/import.c | 3 --- 2 files changed, 5 deletions(-) diff --git a/Include/internal/pycore_interp_structs.h b/Include/internal/pycore_interp_structs.h index 956fa290f0a..5500c70a3b0 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 42bfe15121f..6da6faf5f28 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 *