Message28285
| Author |
jakamkon |
| Recipients |
| Date |
2006年07月11日.15:02:27 |
| SpamBayes Score |
| Marked as misclassified |
| Message-id |
| In-reply-to |
| Content |
Logged In: YES
user_id=1491175
Simple solution is to catch TypeError in bdb's run function:
try:
if not isinstance(cmd, types.CodeType):
cmd = cmd+'\n'
except TypeError:
pass
Now it seems that handling nonstring arguments is better:
>>> import pdb
>>> def x():pass
...
>>> pdb.run(x())
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/jkk/python-svn/Lib/pdb.py", line 1122, in run
Pdb().run(statement, globals, locals)
File "/home/jkk/python-svn/Lib/bdb.py", line 369, in run
exec cmd in globals, locals
TypeError: exec: arg 1 must be a string, file, or code object
>>> pdb.run('x()')
> <string>(1)<module>()
(Pdb) x
<function x at 0x4024a9cc>
(Pdb) pdb.run('x()')
(Pdb)
>>>
|
|
History
|
|---|
| Date |
User |
Action |
Args |
| 2007年08月23日 14:39:31 | admin | link | issue1472251 messages |
| 2007年08月23日 14:39:31 | admin | create |
|