summaryrefslogtreecommitdiff
path: root/Python
diff options
context:
space:
mode:
Diffstat (limited to 'Python')
-rw-r--r--Python/ceval.c19
1 files changed, 10 insertions, 9 deletions
diff --git a/Python/ceval.c b/Python/ceval.c
index 096645aeeb..5e586589e9 100644
--- a/Python/ceval.c
+++ b/Python/ceval.c
@@ -3230,20 +3230,21 @@ main_loop:
}
case TARGET(BEFORE_ASYNC_WITH): {
- _Py_IDENTIFIER(__aexit__);
_Py_IDENTIFIER(__aenter__);
-
+ _Py_IDENTIFIER(__aexit__);
PyObject *mgr = TOP();
- PyObject *exit = special_lookup(tstate, mgr, &PyId___aexit__),
- *enter;
+ PyObject *enter = special_lookup(tstate, mgr, &PyId___aenter__);
PyObject *res;
- if (exit == NULL)
+ if (enter == NULL) {
+ goto error;
+ }
+ PyObject *exit = special_lookup(tstate, mgr, &PyId___aexit__);
+ if (exit == NULL) {
+ Py_DECREF(enter);
goto error;
+ }
SET_TOP(exit);
- enter = special_lookup(tstate, mgr, &PyId___aenter__);
Py_DECREF(mgr);
- if (enter == NULL)
- goto error;
res = _PyObject_CallNoArg(enter);
Py_DECREF(enter);
if (res == NULL)
@@ -3264,8 +3265,8 @@ main_loop:
}
case TARGET(SETUP_WITH): {
- _Py_IDENTIFIER(__exit__);
_Py_IDENTIFIER(__enter__);
+ _Py_IDENTIFIER(__exit__);
PyObject *mgr = TOP();
PyObject *enter = special_lookup(tstate, mgr, &PyId___enter__);
PyObject *res;