problem in pdb?
Keith Beattie
KSBeattie at lbl.gov
Mon Oct 6 16:37:17 EDT 2003
Hi all,
So in learning about the python debugger I've come across what appears
to be a problem with pdb not 'letting go' when given a bad argument to
the run() call. It is as if pdb doesn't clean up when exiting abnormally.
In the example below when the first call to pdb.run is intentially given
a bad arg (not a string) it understandable throws an exception. Then
when calling the function not using pdb, pdb is still there and
complains more when exiting the debugging that I never expected.
TIA,
ksb
$ cat foo.py
def bar():
print "hello"
$ python
Python 2.3.1 (#1, Sep 30 2003, 13:32:49)
[GCC 3.2.2 [FreeBSD] 20030205 (release)] on freebsd5
Type "help", "copyright", "credits" or "license" for more information.
>>> import pdb
>>> import foo
>>> pdb.run(foo.bar())
hello
Traceback (most recent call last):
File "<stdin>", line 1, in ?
File "/usr/local/lib/python2.3/pdb.py", line 979, in run
Pdb().run(statement, globals, locals)
File "/usr/local/lib/python2.3/bdb.py", line 347, in run
cmd = cmd+'\n'
TypeError: unsupported operand type(s) for +: 'NoneType' and 'str'
>>> foo.bar()
> /path/to/ksb/Scratch/Python/pdb/foo.py(2)bar()
-> print "hello"
(Pdb) exit
Traceback (most recent call last):
File "<stdin>", line 1, in ?
File "foo.py", line 2, in bar
print "hello"
File "foo.py", line 2, in bar
print "hello"
File "/usr/local/lib/python2.3/bdb.py", line 48, in trace_dispatch
return self.dispatch_line(frame)
File "/usr/local/lib/python2.3/bdb.py", line 61, in dispatch_line
if self.quitting: raise BdbQuit
bdb.BdbQuit
>>> foo.bar()
hello
>>>
More information about the Python-list
mailing list