Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 4bd8172

Browse files
author
Victor Stinner
committed
Issue #10492: bdb.Bdb.run() only traces the execution of the code
And not the compilation (if the input is a string).
1 parent 457ab06 commit 4bd8172

2 files changed

Lines changed: 5 additions & 0 deletions

File tree

Lib/bdb.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -385,6 +385,8 @@ def run(self, cmd, globals=None, locals=None):
385385
if locals is None:
386386
locals = globals
387387
self.reset()
388+
if isinstance(cmd, str):
389+
cmd = compile(cmd, "<string>", "exec")
388390
sys.settrace(self.trace_dispatch)
389391
try:
390392
exec(cmd, globals, locals)

Misc/NEWS

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,9 @@ Core and Builtins
3030
Library
3131
-------
3232

33+
- Issue #10492: bdb.Bdb.run() only traces the execution of the code, not the
34+
compilation (if the input is a string).
35+
3336
- Issue #7995: When calling accept() on a socket with a timeout, the returned
3437
socket is now always blocking, regardless of the operating system.
3538

0 commit comments

Comments
 (0)