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:
Mark Shannon 2023-01-24 17:25:37 +00:00 committed by GitHub
parent daec3a463c
commit f02fa64bf2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 39 additions and 12 deletions

View file

@ -492,7 +492,7 @@ dis_asyncwith = """\
GET_AWAITABLE 1
LOAD_CONST 0 (None)
>> SEND 3 (to 22)
YIELD_VALUE 3
YIELD_VALUE 2
RESUME 3
JUMP_BACKWARD_NO_INTERRUPT 4 (to 14)
>> POP_TOP
@ -526,7 +526,7 @@ dis_asyncwith = """\
GET_AWAITABLE 2
LOAD_CONST 0 (None)
>> SEND 4 (to 92)
YIELD_VALUE 6
YIELD_VALUE 3
RESUME 3
JUMP_BACKWARD_NO_INTERRUPT 4 (to 82)
>> CLEANUP_THROW