diff options
author | Guido van Rossum <guido@python.org> | 1996-10-15 14:40:21 (GMT) |
---|---|---|
committer | Guido van Rossum <guido@python.org> | 1996-10-15 14:40:21 (GMT) |
commit | 4808dcb5645d88f185c22a4fdff489dc8816240c (patch) | |
tree | 0e54e8471dc8d803ab75637bc6077c4ad0182a11 /Lib/bdb.py | |
parent | 7e42caba018e86cb658b6d445d7614532e5ed192 (diff) | |
download | cpython-4808dcb5645d88f185c22a4fdff489dc8816240c.zip cpython-4808dcb5645d88f185c22a4fdff489dc8816240c.tar.gz cpython-4808dcb5645d88f185c22a4fdff489dc8816240c.tar.bz2 |
Allow code objects to be passed to run() and eval().
Diffstat (limited to 'Lib/bdb.py')
-rw-r--r-- | Lib/bdb.py | 9 |
1 files changed, 7 insertions, 2 deletions
@@ -7,6 +7,7 @@ # And of course... you can roll your own! import sys +import types BdbQuit = 'bdb.BdbQuit' # Exception to give up completely @@ -278,9 +279,11 @@ class Bdb: # Basic Debugger locals = globals self.reset() sys.settrace(self.trace_dispatch) + if type(cmd) <> types.CodeType: + cmd = cmd+'\n' try: try: - exec cmd + '\n' in globals, locals + exec cmd in globals, locals except BdbQuit: pass finally: @@ -295,9 +298,11 @@ class Bdb: # Basic Debugger locals = globals self.reset() sys.settrace(self.trace_dispatch) + if type(expr) <> types.CodeType: + expr = expr+'\n' try: try: - return eval(expr + '\n', globals, locals) + return eval(expr, globals, locals) except BdbQuit: pass finally: |