[3.12] gh-109853: Fix sys.path[0] For Subinterpreters (gh-109994) (gh-110701)

This change makes sure sys.path[0] is set properly for subinterpreters.  Before, it wasn't getting set at all.

This change does not address the broader concerns from gh-109853.

(cherry-picked from commit a040a32ea2)
This commit is contained in:
Eric Snow 2023-11-27 15:21:12 -07:00 committed by GitHub
parent 592a849fdf
commit 313554457e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 26702 additions and 26487 deletions

View file

@ -524,6 +524,10 @@ _PyRuntimeState_Fini(_PyRuntimeState *runtime)
}
#undef FREE_LOCK
if (runtime->sys_path_0 != NULL) {
PyMem_RawFree(runtime->sys_path_0);
runtime->sys_path_0 = NULL;
}
PyMem_SetAllocator(PYMEM_DOMAIN_RAW, &old_alloc);
}