diff options
author | Miss Islington (bot) <31488909+miss-islington@users.noreply.github.com> | 2018-03-11 08:55:59 (GMT) |
---|---|---|
committer | Serhiy Storchaka <storchaka@gmail.com> | 2018-03-11 08:55:59 (GMT) |
commit | 3854f5885edc8dc67b1aba82fbb525604fbc625b (patch) | |
tree | 0a0bbb9d9abf6ef0ba2ffdbfcc4df8be91cd4126 /Objects/frameobject.c | |
parent | 34bb88dc5bc447832db8c7ccdc173311e0685eab (diff) | |
download | cpython-3854f5885edc8dc67b1aba82fbb525604fbc625b.zip cpython-3854f5885edc8dc67b1aba82fbb525604fbc625b.tar.gz cpython-3854f5885edc8dc67b1aba82fbb525604fbc625b.tar.bz2 |
[2.7] bpo-33026: Fix jumping out of "with" block by setting f_lineno. (GH-6026). (GH-6074) (GH-6076)
(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 | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/Objects/frameobject.c b/Objects/frameobject.c index 2c8fb01..bf1c7c5 100644 --- a/Objects/frameobject.c +++ b/Objects/frameobject.c @@ -340,6 +340,11 @@ frame_setlineno(PyFrameObject *f, PyObject* p_new_lineno) PyObject *v = (*--f->f_stacktop); Py_DECREF(v); } + if (b->b_type == SETUP_WITH) { + /* Pop the exit function. */ + PyObject *v = (*--f->f_stacktop); + Py_DECREF(v); + } } /* Finally set the new f_lineno and f_lasti and return OK. */ |