GH-99205: Mark new interpreters and threads as non-static#99268
GH-99205: Mark new interpreters and threads as non-static#99268brandtbucher merged 4 commits intopython:mainfrom
Conversation
ericsnowcurrently
left a comment
There was a problem hiding this comment.
LGTM
I've pointed out two places where a comment would be appropriate. I'm approving the PR under the assumption you'll take care of those.
| memcpy(tstate, | ||
| &initial._main_interpreter._initial_thread, | ||
| sizeof(*tstate)); | ||
| tstate->_static = false; |
There was a problem hiding this comment.
Please add a note pointing to PyThreadState_INIT() and indicating that fields set there should be adjusted here as appropriate.
| // Set to _PyInterpreterState_INIT. | ||
| memcpy(interp, &initial._main_interpreter, | ||
| sizeof(*interp)); | ||
| interp->_static = false; |
There was a problem hiding this comment.
Likewise, a note pointing to PyInterpreterState_INIT().
|
Thanks for fixing this, BTW. |
|
@pablogsal, leak tests didn't catch this because we use the "raw" domain to allocate |
|
Oh interesting, can you confirm that changing the domain to memory makes the test fail? |
You can't. :) See this comment: Lines 818 to 821 in 58ee5d8 |
|
Thanks @brandtbucher for the PR 🌮🎉.. I'm working now to backport this PR to: 3.11. |
|
GH-99301 is a backport of this pull request to the 3.11 branch. |
…onGH-99268) (cherry picked from commit 283ab0e) Co-authored-by: Brandt Bucher <[email protected]>
(cherry picked from commit 283ab0e) Co-authored-by: Brandt Bucher <[email protected]>
PyThreadStateandPyInterpreterStateare not freed #99205