]> granicus.if.org Git - python/commitdiff
Issue #10492: bdb.Bdb.run() only traces the execution of the code
authorVictor Stinner <victor.stinner@haypocalc.com>
Thu, 6 Jan 2011 00:49:38 +0000 (00:49 +0000)
committerVictor Stinner <victor.stinner@haypocalc.com>
Thu, 6 Jan 2011 00:49:38 +0000 (00:49 +0000)
And not the compilation (if the input is a string).

Lib/bdb.py
Misc/NEWS

index 9f5e7ae630d0d310b13acb3e46f7568ae35455a1..f711004483da66e51845425fa42d359f23f0af9c 100644 (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)
index cd55adb06c8e4ae586b7b4d56826e1eb17a1e0af..3cd9257d7bd6a88d2a42633a5f5478002d060e4b 100644 (file)
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -30,6 +30,9 @@ Core and Builtins
 Library
 -------
 
+- Issue #10492: bdb.Bdb.run() only traces the execution of the code, not the
+  compilation (if the input is a string).
+
 - Issue #7995: When calling accept() on a socket with a timeout, the returned
   socket is now always blocking, regardless of the operating system.