Skip to content

Commit 286f281

Browse files
committed
Reword comment in frame_setlineno for clarity.
1 parent eeb0e4d commit 286f281

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

Objects/frameobject.c

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -355,11 +355,14 @@ frame_setlineno(PyFrameObject *f, PyObject* p_new_lineno, void *Py_UNUSED(ignore
355355
return -1;
356356
}
357357

358-
/* Forbid jumps upon a 'return' trace event (except after executing a
359-
* YIELD_VALUE or YIELD_FROM opcode)
360-
* and upon an 'exception' trace event.
361-
* Jumps from 'call' trace events have already been forbidden above for new
362-
* frames, so this check does not change anything for 'call' events. */
358+
/*
359+
* This code preserves the historical restrictions on
360+
* setting the line number of a frame.
361+
* Jumps are forbidden on a 'return' trace event (except after a yield).
362+
* Jumps from 'call' trace events are also forbidden.
363+
* In addition, jumps are forbidden when not tracing,
364+
* as this is a debugging feature.
365+
*/
363366
switch(f->f_state) {
364367
case FRAME_CREATED:
365368
PyErr_Format(PyExc_ValueError,

0 commit comments

Comments
 (0)