@@ -1955,37 +1955,36 @@ compiler_call_exit_with_nones(struct compiler *c) {
1955
1955
static int
1956
1956
compiler_add_yield_from (struct compiler * c , int await )
1957
1957
{
1958
- basicblock * start , * resume , * stopiter , * error , * exit ;
1958
+ basicblock * start , * resume , * error , * stopiter , * exit ;
1959
1959
RETURN_IF_FALSE (start = compiler_new_block (c ));
1960
1960
RETURN_IF_FALSE (resume = compiler_new_block (c ));
1961
- RETURN_IF_FALSE (stopiter = compiler_new_block (c ));
1962
1961
RETURN_IF_FALSE (error = compiler_new_block (c ));
1962
+ RETURN_IF_FALSE (stopiter = compiler_new_block (c ));
1963
1963
RETURN_IF_FALSE (exit = compiler_new_block (c ));
1964
1964
compiler_use_next_block (c , start );
1965
1965
ADDOP_JUMP (c , SEND , exit );
1966
1966
compiler_use_next_block (c , resume );
1967
1967
// Set up a virtual try/except to handle StopIteration raised during a
1968
1968
// close() or throw():
1969
- ADDOP_JUMP (c , SETUP_FINALLY , stopiter );
1969
+ ADDOP_JUMP (c , SETUP_FINALLY , error );
1970
1970
RETURN_IF_FALSE (compiler_push_fblock (c , TRY_EXCEPT , resume , NULL , NULL ));
1971
1971
// The only way YIELD_VALUE can raise is if close() or throw() raises:
1972
1972
ADDOP (c , YIELD_VALUE );
1973
1973
compiler_pop_fblock (c , TRY_EXCEPT , resume );
1974
1974
ADDOP_NOLINE (c , POP_BLOCK );
1975
1975
ADDOP_I (c , RESUME , await ? 3 : 2 );
1976
1976
ADDOP_JUMP (c , JUMP_NO_INTERRUPT , start );
1977
- compiler_use_next_block (c , stopiter );
1977
+ compiler_use_next_block (c , error );
1978
1978
ADDOP_I (c , LOAD_EXCEPTION_TYPE , 1 ); // StopIteration
1979
1979
ADDOP (c , CHECK_EXC_MATCH );
1980
- ADDOP_JUMP (c , POP_JUMP_IF_FALSE , error );
1980
+ ADDOP_JUMP (c , POP_JUMP_IF_TRUE , stopiter );
1981
+ ADDOP_I (c , RERAISE , 0 );
1982
+ compiler_use_next_block (c , stopiter );
1981
1983
// StopIteration was raised. Push the return value and continue execution:
1982
1984
ADDOP_NAME (c , LOAD_ATTR , & _Py_ID (value ), names );
1983
1985
ADDOP_I (c , SWAP , 3 );
1984
1986
ADDOP (c , POP_TOP );
1985
1987
ADDOP (c , POP_TOP );
1986
- ADDOP_JUMP (c , JUMP , exit );
1987
- compiler_use_next_block (c , error );
1988
- ADDOP_I (c , RERAISE , 0 );
1989
1988
compiler_use_next_block (c , exit );
1990
1989
return 1 ;
1991
1990
}
0 commit comments