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 143143 check_impl_detail , requires_debug_ranges ,
144144 gc_collect , Py_GIL_DISABLED ,
145145 suppress_immortalization ,
146- skip_if_suppress_immortalization )
146+ skip_if_suppress_immortalization , late_deletion )
147147from test .support .script_helper import assert_python_ok
148148from test .support import threading_helper , import_helper
149149from test .support .bytecode_helper import instructions_with_positions
@@ -844,6 +844,11 @@ def myfree(ptr):
844844
845845 FREE_FUNC = freefunc (myfree )
846846 FREE_INDEX = RequestCodeExtraIndex (FREE_FUNC )
847+ # Make sure myfree sticks around at least as long as the interpreter,
848+ # since we (currently) can't unregister the function and leaving a
849+ # dangling pointer will cause a crash on deallocation of code objects if
850+ # something else uses co_extras, like test_capi.test_misc.
851+ late_deletion (myfree )
847852
848853 class CoExtra (unittest .TestCase ):
849854 def get_func (self ):
You can’t perform that action at this time.
0 commit comments