Skip to content

Commit 9875ce1

Browse files
drinkmorewaterrmeta-codesync[bot]
authored andcommitted
Add patch '17-gh-pr-141537' to third-party/python/3.14
Summary: We need this PR to resolve a segfault - python/cpython#141537 Patching it in now since it may be some time before it lands in upstream + get backported to 3.14 This diff adds a patch to the `third-party/python/3.14` Meta-internal fork. Fix a crash when running test_capi *after* test_code in the same process Reviewed By: itamaro Differential Revision: D87464010 fbshipit-source-id: 79e515ab5733a365ef52c821b06c59f59ded0a7a
1 parent c08d554 commit 9875ce1

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

Lib/test/test_code.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,7 @@
210210
ctypes = None
211211
from 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)
214214
from test.support.script_helper import assert_python_ok
215215
from test.support import threading_helper, import_helper
216216
from 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):

0 commit comments

Comments
 (0)