diff options
author | Raymond Hettinger <python@rcn.com> | 2016-11-21 17:24:23 -0800 |
---|---|---|
committer | Raymond Hettinger <python@rcn.com> | 2016-11-21 17:24:23 -0800 |
commit | a016e87125f3ab6157fea573e77a44a24c3565c8 (patch) | |
tree | 410c0fa55005b0e8683a6cf35da2d8ac09f39a04 /Python | |
parent | 457f365ab250df6f014ef3339825d485e51b779a (diff) | |
download | cpython-a016e87125f3ab6157fea573e77a44a24c3565c8.tar.gz |
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 a9d7c2f6d3..ebf073a87f 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) |