Issue #10492: bdb.Bdb.run() only traces the execution of the code

And not the compilation (if the input is a string).
This commit is contained in:
Victor Stinner 2011-01-06 00:49:38 +00:00
parent 457ab068a3
commit 4bd81725f2
2 changed files with 5 additions and 0 deletions

View file

@ -385,6 +385,8 @@ class Bdb:
if locals is None:
locals = globals
self.reset()
if isinstance(cmd, str):
cmd = compile(cmd, "<string>", "exec")
sys.settrace(self.trace_dispatch)
try:
exec(cmd, globals, locals)