mirror of
https://github.com/python/cpython.git
synced 2025-11-01 10:45:30 +00:00
Better behavior when stepping over yield[from]. Fixes issue 16596. By Xavier de Gaye.
This commit is contained in:
parent
9c55a58a1d
commit
8820c239f7
4 changed files with 351 additions and 7 deletions
12
Lib/pdb.py
12
Lib/pdb.py
|
|
@ -297,8 +297,16 @@ class Pdb(bdb.Bdb, cmd.Cmd):
|
|||
return
|
||||
exc_type, exc_value, exc_traceback = exc_info
|
||||
frame.f_locals['__exception__'] = exc_type, exc_value
|
||||
self.message(traceback.format_exception_only(exc_type,
|
||||
exc_value)[-1].strip())
|
||||
|
||||
# An 'Internal StopIteration' exception is an exception debug event
|
||||
# issued by the interpreter when handling a subgenerator run with
|
||||
# 'yield from' or a generator controled by a for loop. No exception has
|
||||
# actually occured in this case. The debugger uses this debug event to
|
||||
# stop when the debuggee is returning from such generators.
|
||||
prefix = 'Internal ' if (not exc_traceback
|
||||
and exc_type is StopIteration) else ''
|
||||
self.message('%s%s' % (prefix,
|
||||
traceback.format_exception_only(exc_type, exc_value)[-1].strip()))
|
||||
self.interaction(frame, exc_traceback)
|
||||
|
||||
# General interaction function
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue