summaryrefslogtreecommitdiff
path: root/Lib/inspect.py
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/inspect.py')
-rw-r--r--Lib/inspect.py12
1 files changed, 6 insertions, 6 deletions
diff --git a/Lib/inspect.py b/Lib/inspect.py
index 8236698b8d..7a8f5d3464 100644
--- a/Lib/inspect.py
+++ b/Lib/inspect.py
@@ -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):