@@ -770,18 +770,16 @@ dummy_func(
770
770
ERROR_IF (val == NULL , error );
771
771
}
772
772
773
- // stack effect: (__0, __1 -- )
774
- inst (END_ASYNC_FOR ) {
775
- PyObject * val = POP ();
776
- assert (val && PyExceptionInstance_Check (val ));
777
- if (PyErr_GivenExceptionMatches (val , PyExc_StopAsyncIteration )) {
778
- Py_DECREF (val );
779
- Py_DECREF (POP ());
773
+ inst (END_ASYNC_FOR , (awaitable , exc -- )) {
774
+ assert (exc && PyExceptionInstance_Check (exc ));
775
+ if (PyErr_GivenExceptionMatches (exc , PyExc_StopAsyncIteration )) {
776
+ DECREF_INPUTS ();
780
777
}
781
778
else {
782
- PyObject * exc = Py_NewRef (PyExceptionInstance_Class (val ));
783
- PyObject * tb = PyException_GetTraceback (val );
784
- _PyErr_Restore (tstate , exc , val , tb );
779
+ Py_INCREF (exc );
780
+ PyObject * typ = Py_NewRef (PyExceptionInstance_Class (exc ));
781
+ PyObject * tb = PyException_GetTraceback (exc );
782
+ _PyErr_Restore (tstate , typ , exc , tb );
785
783
goto exception_unwind ;
786
784
}
787
785
}
@@ -2266,10 +2264,7 @@ dummy_func(
2266
2264
DISPATCH_INLINED (gen_frame );
2267
2265
}
2268
2266
2269
- // stack effect: ( -- __0)
2270
- inst (BEFORE_ASYNC_WITH ) {
2271
- PyObject * mgr = TOP ();
2272
- PyObject * res ;
2267
+ inst (BEFORE_ASYNC_WITH , (mgr -- exit , res )) {
2273
2268
PyObject * enter = _PyObject_LookupSpecial (mgr , & _Py_ID (__aenter__ ));
2274
2269
if (enter == NULL ) {
2275
2270
if (!_PyErr_Occurred (tstate )) {
@@ -2280,7 +2275,7 @@ dummy_func(
2280
2275
}
2281
2276
goto error ;
2282
2277
}
2283
- PyObject * exit = _PyObject_LookupSpecial (mgr , & _Py_ID (__aexit__ ));
2278
+ exit = _PyObject_LookupSpecial (mgr , & _Py_ID (__aexit__ ));
2284
2279
if (exit == NULL ) {
2285
2280
if (!_PyErr_Occurred (tstate )) {
2286
2281
_PyErr_Format (tstate , PyExc_TypeError ,
@@ -2292,13 +2287,13 @@ dummy_func(
2292
2287
Py_DECREF (enter );
2293
2288
goto error ;
2294
2289
}
2295
- SET_TOP (exit );
2296
- Py_DECREF (mgr );
2290
+ DECREF_INPUTS ();
2297
2291
res = _PyObject_CallNoArgs (enter );
2298
2292
Py_DECREF (enter );
2299
- if (res == NULL )
2300
- goto error ;
2301
- PUSH (res );
2293
+ if (res == NULL ) {
2294
+ Py_DECREF (exit );
2295
+ ERROR_IF (true, error );
2296
+ }
2302
2297
PREDICT (GET_AWAITABLE );
2303
2298
}
2304
2299
0 commit comments