summaryrefslogtreecommitdiffstats
path: root/Objects/frameobject.c
diff options
context:
space:
mode:
authorBenjamin Peterson <benjamin@python.org>2012-04-18 15:14:31 (GMT)
committerBenjamin Peterson <benjamin@python.org>2012-04-18 15:14:31 (GMT)
commite42fb307edbdc8bb98fa5d43646cbbe33f307501 (patch)
tree1d23b730927815b1ccb16b0b2e59b20858397a18 /Objects/frameobject.c
parent32c59b6fc1140486a9915876054365b40bd88da9 (diff)
downloadcpython-e42fb307edbdc8bb98fa5d43646cbbe33f307501.zip
cpython-e42fb307edbdc8bb98fa5d43646cbbe33f307501.tar.gz
cpython-e42fb307edbdc8bb98fa5d43646cbbe33f307501.tar.bz2
SETUP_WITH acts like SETUP_FINALLY for the purposes of setting f_lineno (closes #14612)
Diffstat (limited to 'Objects/frameobject.c')
-rw-r--r--Objects/frameobject.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/Objects/frameobject.c b/Objects/frameobject.c
index 10fb8b3..adce42b 100644
--- a/Objects/frameobject.c
+++ b/Objects/frameobject.c
@@ -199,6 +199,7 @@ frame_setlineno(PyFrameObject *f, PyObject* p_new_lineno)
case SETUP_LOOP:
case SETUP_EXCEPT:
case SETUP_FINALLY:
+ case SETUP_WITH:
blockstack[blockstack_top++] = addr;
in_finally[blockstack_top-1] = 0;
break;
@@ -206,7 +207,7 @@ frame_setlineno(PyFrameObject *f, PyObject* p_new_lineno)
case POP_BLOCK:
assert(blockstack_top > 0);
setup_op = code[blockstack[blockstack_top-1]];
- if (setup_op == SETUP_FINALLY) {
+ if (setup_op == SETUP_FINALLY || setup_op == SETUP_WITH) {
in_finally[blockstack_top-1] = 1;
}
else {
@@ -221,7 +222,7 @@ frame_setlineno(PyFrameObject *f, PyObject* p_new_lineno)
* be seeing such an END_FINALLY.) */
if (blockstack_top > 0) {
setup_op = code[blockstack[blockstack_top-1]];
- if (setup_op == SETUP_FINALLY) {
+ if (setup_op == SETUP_FINALLY || setup_op == SETUP_WITH) {
blockstack_top--;
}
}
@@ -283,6 +284,7 @@ frame_setlineno(PyFrameObject *f, PyObject* p_new_lineno)
case SETUP_LOOP:
case SETUP_EXCEPT:
case SETUP_FINALLY:
+ case SETUP_WITH:
delta_iblock++;
break;