mirror of
https://github.com/python/cpython.git
synced 2025-07-09 20:35:26 +00:00
gh-111354: simplify detection of RESUME after YIELD_VALUE at except-depth 1 (#111459)
This commit is contained in:
parent
970e719a7a
commit
52cc4af6ae
18 changed files with 362 additions and 339 deletions
6
Python/generated_cases.c.h
generated
6
Python/generated_cases.c.h
generated
|
@ -35,7 +35,7 @@
|
|||
next_instr = this_instr;
|
||||
}
|
||||
else {
|
||||
if (oparg < RESUME_AFTER_YIELD_FROM) {
|
||||
if ((oparg & RESUME_OPARG_LOCATION_MASK) < RESUME_AFTER_YIELD_FROM) {
|
||||
CHECK_EVAL_BREAKER();
|
||||
}
|
||||
this_instr->op.code = RESUME_CHECK;
|
||||
|
@ -71,7 +71,7 @@
|
|||
next_instr = this_instr;
|
||||
}
|
||||
else {
|
||||
if (oparg < 2) {
|
||||
if ((oparg & RESUME_OPARG_LOCATION_MASK) < RESUME_AFTER_YIELD_FROM) {
|
||||
CHECK_EVAL_BREAKER();
|
||||
}
|
||||
_PyFrame_SetStackPointer(frame, stack_pointer);
|
||||
|
@ -1499,7 +1499,6 @@
|
|||
PyObject *retval;
|
||||
retval = stack_pointer[-1];
|
||||
assert(frame != &entry_frame);
|
||||
assert(oparg >= 0); /* make the generator identify this as HAS_ARG */
|
||||
frame->instr_ptr = next_instr;
|
||||
PyGenObject *gen = _PyFrame_GetGenerator(frame);
|
||||
gen->gi_frame_state = FRAME_SUSPENDED;
|
||||
|
@ -1530,7 +1529,6 @@
|
|||
// NOTE: It's important that YIELD_VALUE never raises an exception!
|
||||
// The compiler treats any exception raised here as a failed close()
|
||||
// or throw() call.
|
||||
assert(oparg >= 0); /* make the generator identify this as HAS_ARG */
|
||||
assert(frame != &entry_frame);
|
||||
frame->instr_ptr = next_instr;
|
||||
PyGenObject *gen = _PyFrame_GetGenerator(frame);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue