mirror of https://github.com/python/cpython
gh-121814: Only check f_trace_opcodes if Python frame exists (#121818)
Co-authored-by: Matt Wozniski <godlygeek@gmail.com>
This commit is contained in:
parent
4134261ab8
commit
2b1b68939b
|
@ -0,0 +1 @@
|
|||
Fixed the SegFault when :c:func:`PyEval_SetTrace` is used with no Python frame on stack.
|
|
@ -605,7 +605,7 @@ _PyEval_SetTrace(PyThreadState *tstate, Py_tracefunc func, PyObject *arg)
|
|||
(1 << PY_MONITORING_EVENT_STOP_ITERATION);
|
||||
|
||||
PyFrameObject* frame = PyEval_GetFrame();
|
||||
if (frame->f_trace_opcodes) {
|
||||
if (frame && frame->f_trace_opcodes) {
|
||||
int ret = _PyEval_SetOpcodeTrace(frame, true);
|
||||
if (ret != 0) {
|
||||
return ret;
|
||||
|
|
Loading…
Reference in New Issue