mirror of
https://github.com/python/cpython.git
synced 2025-08-25 03:04:55 +00:00
GH-100762: Don't call gen.throw()
in gen.close()
, unless necessary. (GH-101013)
* Store exception stack depth in YIELD_VALUE's oparg and use it avoid expensive gen.throw() in gen.close() where possible.
This commit is contained in:
parent
daec3a463c
commit
f02fa64bf2
9 changed files with 39 additions and 12 deletions
|
@ -720,7 +720,6 @@ dummy_func(
|
|||
// 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 == STACK_LEVEL());
|
||||
assert(frame != &entry_frame);
|
||||
PyGenObject *gen = _PyFrame_GetGenerator(frame);
|
||||
gen->gi_frame_state = FRAME_SUSPENDED;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue