Skip to content

Commit 04f91c3

Browse files
jbower-fbmeta-codesync[bot]
authored andcommitted
For lightweight-frames ensure frame is initialized in maybe_set_opcode_trace
Summary: Not doing this causes `test.test_dynamic.TestTracing.test_after_specialization` to segfault with a trace like this: ``` * thread #1, stop reason = signal SIGSEGV * frame #0: 0x00000000007ac592 mmap_clone_4_python3.14`maybe_set_opcode_trace(tstate=0x0000000000a21780) at legacy_tracing.c:690 frame #1: 0x00000000007ac344 mmap_clone_4_python3.14`_PyEval_SetTrace(tstate=0x0000000000a21780, func=(mmap_clone_4_python3.14`trace_trampoline at sysmodule.c:1103), arg=<function instance at 0x00007fa2830e44d0>) at legacy_tracing.c:724 frame #2: 0x0000000000834b47 mmap_clone_4_python3.14`sys_settrace(module=<unavailable>, function=<unavailable>) at sysmodule.c:1155 frame #3: 0x00007fa2743c2594 _cinderx.so`::_PyObject_VectorcallTstate() at pycore_call.h:169 frame #4: 0x00007fa2743c26a6 _cinderx.so`::JITRT_Vectorcall() at jit_rt.cpp:1032 frame #5: 0x00007fa26f086cae ``` Reviewed By: itamaro, DinoV Differential Revision: D90545688 fbshipit-source-id: e091f8259112c845b92795dd7b211f7319b02837
1 parent 01ede43 commit 04f91c3

1 file changed

Lines changed: 1 addition & 0 deletions

File tree

Python/legacy_tracing.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -686,6 +686,7 @@ maybe_set_opcode_trace(PyThreadState *tstate)
686686
if (iframe == NULL) {
687687
return 0;
688688
}
689+
_PyFrame_EnsureFrameFullyInitialized(iframe);
689690
PyFrameObject *frame = iframe->frame_obj;
690691
if (frame == NULL || !frame->f_trace_opcodes) {
691692
return 0;

0 commit comments

Comments
 (0)