-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[tools/depends][python3] Patch upstream issue memleak
A memleak was found in cpython 3.11.0 that looks to potentially be reasonably serious Upstream issue is python/cpython#99205 This uses the merged upstream patch python/cpython#99301 until we bump to a newer release (3.11.1+)
- Loading branch information
fuzzard
committed
Nov 10, 2022
1 parent
31ceec9
commit 859405e
Showing
2 changed files
with
42 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
--- a/Python/pystate.c | ||
+++ b/Python/pystate.c | ||
@@ -341,6 +341,7 @@ PyInterpreterState_New(void) | ||
interp = &runtime->_main_interpreter; | ||
assert(interp->id == 0); | ||
assert(interp->next == NULL); | ||
+ assert(interp->_static); | ||
|
||
interpreters->main = interp; | ||
} | ||
@@ -355,6 +356,9 @@ PyInterpreterState_New(void) | ||
// Set to _PyInterpreterState_INIT. | ||
memcpy(interp, &initial._main_interpreter, | ||
sizeof(*interp)); | ||
+ // We need to adjust any fields that are different from the initial | ||
+ // interpreter (as defined in _PyInterpreterState_INIT): | ||
+ interp->_static = false; | ||
|
||
if (id < 0) { | ||
/* overflow or Py_Initialize() not called yet! */ | ||
@@ -817,6 +821,7 @@ new_threadstate(PyInterpreterState *interp) | ||
assert(id == 1); | ||
used_newtstate = 0; | ||
tstate = &interp->_initial_thread; | ||
+ assert(tstate->_static); | ||
} | ||
else { | ||
// Every valid interpreter must have at least one thread. | ||
@@ -828,6 +833,9 @@ new_threadstate(PyInterpreterState *interp) | ||
memcpy(tstate, | ||
&initial._main_interpreter._initial_thread, | ||
sizeof(*tstate)); | ||
+ // We need to adjust any fields that are different from the initial | ||
+ // thread (as defined in _PyThreadState_INIT): | ||
+ tstate->_static = false; | ||
} | ||
interp->threads.head = tstate; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters