diff options
author | Raymond Hettinger <python@rcn.com> | 2016-11-22 01:24:23 (GMT) |
---|---|---|
committer | Raymond Hettinger <python@rcn.com> | 2016-11-22 01:24:23 (GMT) |
commit | a3fec1543dc252934e79a4a50b1cbbf4708b4e7e (patch) | |
tree | 9388fdfbb31412809a450f2aeb86da9baef5a84c /Python | |
parent | 4e17e042376ee5c64fad538bba19d786bbdf391c (diff) | |
download | cpython-a3fec1543dc252934e79a4a50b1cbbf4708b4e7e.zip cpython-a3fec1543dc252934e79a4a50b1cbbf4708b4e7e.tar.gz cpython-a3fec1543dc252934e79a4a50b1cbbf4708b4e7e.tar.bz2 |
Issue #27100: With statement reports missing __enter__ before __exit__. (Contributed by Jonathan Ellington.)
Diffstat (limited to 'Python')
-rw-r--r-- | Python/ceval.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/Python/ceval.c b/Python/ceval.c index a9d7c2f..ebf073a 100644 --- a/Python/ceval.c +++ b/Python/ceval.c @@ -3133,15 +3133,15 @@ _PyEval_EvalFrameDefault(PyFrameObject *f, int throwflag) _Py_IDENTIFIER(__exit__); _Py_IDENTIFIER(__enter__); PyObject *mgr = TOP(); - PyObject *exit = special_lookup(mgr, &PyId___exit__), *enter; + PyObject *enter = special_lookup(mgr, &PyId___enter__), *exit; PyObject *res; + if (enter == NULL) + goto error; + exit = special_lookup(mgr, &PyId___exit__); if (exit == NULL) goto error; SET_TOP(exit); - enter = special_lookup(mgr, &PyId___enter__); Py_DECREF(mgr); - if (enter == NULL) - goto error; res = PyObject_CallFunctionObjArgs(enter, NULL); Py_DECREF(enter); if (res == NULL) |