summaryrefslogtreecommitdiffstats
path: root/Lib/bdb.py
diff options
context:
space:
mode:
authorPablo Galindo <Pablogsal@gmail.com>2018-01-29 00:25:05 (GMT)
committerAndrew Svetlov <andrew.svetlov@gmail.com>2018-01-29 00:25:05 (GMT)
commit46877024423e98d1b872bf308dacacd583327207 (patch)
tree4102fda9ce2633eee0ac491dff9e1a99a86f0908 /Lib/bdb.py
parent7c99e931a90d468e8019a0409f16213b3aba7067 (diff)
downloadcpython-46877024423e98d1b872bf308dacacd583327207.zip
cpython-46877024423e98d1b872bf308dacacd583327207.tar.gz
cpython-46877024423e98d1b872bf308dacacd583327207.tar.bz2
bpo-32650: Add native coroutine support to bdb when stepping over line (GH-5400)
Diffstat (limited to 'Lib/bdb.py')
-rw-r--r--Lib/bdb.py12
1 files changed, 6 insertions, 6 deletions
diff --git a/Lib/bdb.py b/Lib/bdb.py
index eb2fa4f..a10362a 100644
--- a/Lib/bdb.py
+++ b/Lib/bdb.py
@@ -3,7 +3,7 @@
import fnmatch
import sys
import os
-from inspect import CO_GENERATOR
+from inspect import CO_GENERATOR, CO_COROUTINE
__all__ = ["BdbQuit", "Bdb", "Breakpoint"]
@@ -127,7 +127,7 @@ class Bdb:
# No need to trace this function
return # None
# Ignore call events in generator except when stepping.
- if self.stopframe and frame.f_code.co_flags & CO_GENERATOR:
+ if self.stopframe and frame.f_code.co_flags & (CO_GENERATOR | CO_COROUTINE):
return self.trace_dispatch
self.user_call(frame, arg)
if self.quitting: raise BdbQuit
@@ -142,7 +142,7 @@ class Bdb:
"""
if self.stop_here(frame) or frame == self.returnframe:
# Ignore return events in generator except when stepping.
- if self.stopframe and frame.f_code.co_flags & CO_GENERATOR:
+ if self.stopframe and frame.f_code.co_flags & (CO_GENERATOR | CO_COROUTINE):
return self.trace_dispatch
try:
self.frame_returning = frame
@@ -166,7 +166,7 @@ class Bdb:
# When stepping with next/until/return in a generator frame, skip
# the internal StopIteration exception (with no traceback)
# triggered by a subiterator run with the 'yield from' statement.
- if not (frame.f_code.co_flags & CO_GENERATOR
+ if not (frame.f_code.co_flags & (CO_GENERATOR | CO_COROUTINE)
and arg[0] is StopIteration and arg[2] is None):
self.user_exception(frame, arg)
if self.quitting: raise BdbQuit
@@ -175,7 +175,7 @@ class Bdb:
# next/until command at the last statement in the generator before the
# exception.
elif (self.stopframe and frame is not self.stopframe
- and self.stopframe.f_code.co_flags & CO_GENERATOR
+ and self.stopframe.f_code.co_flags & (CO_GENERATOR | CO_COROUTINE)
and arg[0] in (StopIteration, GeneratorExit)):
self.user_exception(frame, arg)
if self.quitting: raise BdbQuit
@@ -309,7 +309,7 @@ class Bdb:
def set_return(self, frame):
"""Stop when returning from the given frame."""
- if frame.f_code.co_flags & CO_GENERATOR:
+ if frame.f_code.co_flags & (CO_GENERATOR | CO_COROUTINE):
self._set_stopinfo(frame, None, -1)
else:
self._set_stopinfo(frame.f_back, frame)