diff options
author | Miss Islington (bot) <31488909+miss-islington@users.noreply.github.com> | 2018-03-11 08:21:13 (GMT) |
---|---|---|
committer | Serhiy Storchaka <storchaka@gmail.com> | 2018-03-11 08:21:13 (GMT) |
commit | 20ac11a9fb027f183914bbaaaed091b57c882e54 (patch) | |
tree | 1ef4ea3f3f43039ec2c34d69dee395fe06e90062 /Objects/frameobject.c | |
parent | 3f439d14ad48f5d4f6017fc814326fb1f6237b53 (diff) | |
download | cpython-20ac11a9fb027f183914bbaaaed091b57c882e54.zip cpython-20ac11a9fb027f183914bbaaaed091b57c882e54.tar.gz cpython-20ac11a9fb027f183914bbaaaed091b57c882e54.tar.bz2 |
[3.6] bpo-33026: Fix jumping out of "with" block by setting f_lineno. (GH-6026). (GH-6074) (GH-6075)
(cherry picked from commit 26c9f565d016db21257a60d29ab2c99383dd5ac7)
(cherry picked from commit 04aadf23eac51fec2e436c5960c1362bbb7d03de)
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
Diffstat (limited to 'Objects/frameobject.c')
-rw-r--r-- | Objects/frameobject.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/Objects/frameobject.c b/Objects/frameobject.c index 62f9f34..5c73e85 100644 --- a/Objects/frameobject.c +++ b/Objects/frameobject.c @@ -317,6 +317,13 @@ frame_setlineno(PyFrameObject *f, PyObject* p_new_lineno) PyObject *v = (*--f->f_stacktop); Py_DECREF(v); } + if (b->b_type == SETUP_FINALLY && + code[b->b_handler] == WITH_CLEANUP_START) + { + /* Pop the exit function. */ + PyObject *v = (*--f->f_stacktop); + Py_DECREF(v); + } } /* Finally set the new f_lineno and f_lasti and return OK. */ |