mirror of
https://github.com/python/cpython.git
synced 2026-04-14 07:41:00 +00:00
[3.13] gh-141536: Fix a crash when running test_capi *after* test_code in the same process (GH-141537) (GH-143625)
(cherry picked from commit b2827de18f)
Co-authored-by: T. Wouters <thomas@python.org>
This commit is contained in:
parent
ab8224697a
commit
8a09b511a0
1 changed files with 6 additions and 1 deletions
|
|
@ -143,7 +143,7 @@
|
|||
check_impl_detail, requires_debug_ranges,
|
||||
gc_collect, Py_GIL_DISABLED,
|
||||
suppress_immortalization,
|
||||
skip_if_suppress_immortalization)
|
||||
skip_if_suppress_immortalization, late_deletion)
|
||||
from test.support.script_helper import assert_python_ok
|
||||
from test.support import threading_helper, import_helper
|
||||
from test.support.bytecode_helper import instructions_with_positions
|
||||
|
|
@ -844,6 +844,11 @@ def myfree(ptr):
|
|||
|
||||
FREE_FUNC = freefunc(myfree)
|
||||
FREE_INDEX = RequestCodeExtraIndex(FREE_FUNC)
|
||||
# Make sure myfree sticks around at least as long as the interpreter,
|
||||
# since we (currently) can't unregister the function and leaving a
|
||||
# dangling pointer will cause a crash on deallocation of code objects if
|
||||
# something else uses co_extras, like test_capi.test_misc.
|
||||
late_deletion(myfree)
|
||||
|
||||
class CoExtra(unittest.TestCase):
|
||||
def get_func(self):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue