homepage

This issue tracker has been migrated to GitHub , and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: pdb displays runt Exception strings
Type: behavior Stage: resolved
Components: None Versions: Python 2.6
process
Status: closed Resolution: out of date
Dependencies: Superseder:
Assigned To: Nosy List: Hamish.Downer, paulb, r.david.murray
Priority: normal Keywords:

Created on 2012年08月06日 09:53 by paulb, last changed 2022年04月11日 14:57 by admin. This issue is now closed.

Messages (3)
msg167550 - (view) Author: Paul Backhouse (paulb) Date: 2012年08月06日 09:53
In Python 2.6, pdb doesn't show exception strings properly:
#somecode.py
import pdb
pdb.set_trace()
raise Exception('This is a message that contains a lot of characters and is very long indeed.')
#terminal
> somecode.py
-> raise Exception('This is a message that contains a lot of characters and is very long indeed.')
(Pdb) n
Exception: Exceptio...ndeed.',)
The pdb code assumes that sys.exc_info()[1] is a string. In fact it's an Exception instance.
The solution I found was to use str()
#pdb.py line 186
print >>self.stdout, exc_type_name + ':', _saferepr(str(exc_value))
This may have been fixed already but I couldn't find any reference to it.
msg167562 - (view) Author: R. David Murray (r.david.murray) * (Python committer) Date: 2012年08月06日 13:25
As far as I can see it has been. In both 2.7 and 3.3 I get:
rdmurray@hey:~/python/p33>./python somecode.py
> /home/rdmurray/python/p33/somecode.py(3)<module>()
-> raise Exception('This is a message that contains a lot of characters and is very long indeed.')
(Pdb) n
Exception: This is a message that contains a lot of characters and is very long indeed.
> /home/rdmurray/python/p33/somecode.py(3)<module>()
-> raise Exception('This is a message that contains a lot of characters and is very long indeed.')
(Pdb)
msg177735 - (view) Author: Hamish Downer (Hamish.Downer) Date: 2012年12月19日 11:21
The bug affects me on python 2.7, as described by the original reporter.
I am using Ubuntu 12.04 which comes with python 2.7.3 - was this fixed for 2.7 quite recently?
However the python 3.2 that is packaged for Ubuntu 12.04 does not suffer from this bug.
History
Date User Action Args
2022年04月11日 14:57:33adminsetgithub: 59770
2012年12月19日 11:21:59Hamish.Downersetnosy: + Hamish.Downer
messages: + msg177735
2012年08月06日 13:25:36r.david.murraysetstatus: open -> closed

nosy: + r.david.murray
messages: + msg167562

resolution: out of date
stage: resolved
2012年08月06日 09:53:57paulbcreate

AltStyle によって変換されたページ (->オリジナル) /