File tree Expand file tree Collapse file tree 1 file changed +6
-1
lines changed
Expand file tree Collapse file tree 1 file changed +6
-1
lines changed Original file line number Diff line number Diff line change 210210 ctypes = None
211211from test .support import (cpython_only ,
212212 check_impl_detail , requires_debug_ranges ,
213- gc_collect , Py_GIL_DISABLED )
213+ gc_collect , Py_GIL_DISABLED , late_deletion )
214214from test .support .script_helper import assert_python_ok
215215from test .support import threading_helper , import_helper
216216from test .support .bytecode_helper import instructions_with_positions
@@ -1555,6 +1555,11 @@ def myfree(ptr):
15551555
15561556 FREE_FUNC = freefunc (myfree )
15571557 FREE_INDEX = RequestCodeExtraIndex (FREE_FUNC )
1558+ # Make sure myfree sticks around at least as long as the interpreter,
1559+ # since we (currently) can't unregister the function and leaving a
1560+ # dangling pointer will cause a crash on deallocation of code objects if
1561+ # something else uses co_extras, like test_capi.test_misc.
1562+ late_deletion (myfree )
15581563
15591564 class CoExtra (unittest .TestCase ):
15601565 def get_func (self ):
You can’t perform that action at this time.
0 commit comments