From a3fec1543dc252934e79a4a50b1cbbf4708b4e7e Mon Sep 17 00:00:00 2001 From: Raymond Hettinger Date: Mon, 21 Nov 2016 17:24:23 -0800 Subject: Issue #27100: With statement reports missing __enter__ before __exit__. (Contributed by Jonathan Ellington.) --- Python/ceval.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'Python/ceval.c') 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) -- cgit v1.2.1