mirror of
https://github.com/python/cpython.git
synced 2025-08-27 04:05:34 +00:00
bpo-46409: Make generators in bytecode (GH-30633)
* Add RETURN_GENERATOR and JUMP_NO_INTERRUPT opcodes. * Trim frame and generator by word each. * Minor refactor of frame.c * Update test.test_sys to account for smaller frames. * Treat generator functions as normal functions when evaluating and specializing.
This commit is contained in:
parent
d05a66339b
commit
b04dfbbe4b
18 changed files with 236 additions and 205 deletions
|
@ -1819,11 +1819,11 @@ def getgeneratorstate(generator):
|
|||
"""
|
||||
if generator.gi_running:
|
||||
return GEN_RUNNING
|
||||
if generator.gi_suspended:
|
||||
return GEN_SUSPENDED
|
||||
if generator.gi_frame is None:
|
||||
return GEN_CLOSED
|
||||
if generator.gi_frame.f_lasti == -1:
|
||||
return GEN_CREATED
|
||||
return GEN_SUSPENDED
|
||||
return GEN_CREATED
|
||||
|
||||
|
||||
def getgeneratorlocals(generator):
|
||||
|
@ -1861,11 +1861,11 @@ def getcoroutinestate(coroutine):
|
|||
"""
|
||||
if coroutine.cr_running:
|
||||
return CORO_RUNNING
|
||||
if coroutine.cr_suspended:
|
||||
return CORO_SUSPENDED
|
||||
if coroutine.cr_frame is None:
|
||||
return CORO_CLOSED
|
||||
if coroutine.cr_frame.f_lasti == -1:
|
||||
return CORO_CREATED
|
||||
return CORO_SUSPENDED
|
||||
return CORO_CREATED
|
||||
|
||||
|
||||
def getcoroutinelocals(coroutine):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue