cpython icon indicating copy to clipboard operation
cpython copied to clipboard

GH-99205: Mark new interpreters and threads as non-static

Open brandtbucher opened this issue 3 years ago • 1 comments

  • Issue: gh-99205

brandtbucher avatar Nov 09 '22 00:11 brandtbucher

Thanks for fixing this, BTW.

ericsnowcurrently avatar Nov 09 '22 16:11 ericsnowcurrently

@pablogsal, leak tests didn't catch this because we use the "raw" domain to allocate PyThreadState and PyInterpreterState.

brandtbucher avatar Nov 09 '22 19:11 brandtbucher

Oh interesting, can you confirm that changing the domain to memory makes the test fail?

pablogsal avatar Nov 09 '22 19:11 pablogsal

Oh interesting, can you confirm that changing the domain to memory makes the test fail?

You can't. :)

Fatal Python error: _PyMem_DebugCalloc: Python memory allocator called without holding the GIL
Python runtime state: preinitialized

See this comment:

https://github.com/python/cpython/blob/58ee5d8677fbd4c6c58b7a78117835bccede6bcd/Python/pystate.c#L818-L821

brandtbucher avatar Nov 09 '22 20:11 brandtbucher

Thanks @brandtbucher for the PR 🌮🎉.. I'm working now to backport this PR to: 3.11. 🐍🍒⛏🤖

miss-islington avatar Nov 09 '22 21:11 miss-islington

GH-99301 is a backport of this pull request to the 3.11 branch.

bedevere-bot avatar Nov 09 '22 21:11 bedevere-bot