[ python-Bugs-1106316 ] slightly easier way to debug from the exception handler

SourceForge.net noreply at sourceforge.net
Thu Jan 20 23:51:29 CET 2005


Bugs item #1106316, was opened at 2005-01-20 17:06
Message generated for change (Comment added) made by etrepum
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1106316&group_id=5470

Category: Python Library
Group: Feature Request
Status: Open
Resolution: None
Priority: 5
Submitted By: Leonardo Rochael Almeida (rochael)
Assigned to: Nobody/Anonymous (nobody)
Summary: slightly easier way to debug from the exception handler

Initial Comment:
When interactively developing/debugging a program it'd
be nice if we could throw the user into the pdb prompt
straight from the exception handler.

Currently, pdb.pm() only works outside of the exception
handler, after "sys.last_traceback" has already been
set, which doesn't happen inside the "except:" clause.
The alternative is to use:

 try:
   something...
 except:
   import sys, pdb
   pdb.post_mortem(sys.exc_info()[2])

I propose, as a convenience to the programmer, that the
first parameter to pdb.post_mortem() be made optional,
defaulting to None. In this case, it'd automatically
use the value of sys.exc_info()[2] in place of it's
otherwise mandatory first parameter. The example above
would be reduced to:

 try:
   something...
 except:
   import pdb;pdb.post_mortem()

alternatively, we could make it so that if
"sys.last_traceback" is not set "pdb.pm()" would pick
up sys.exc_info()[2] instead...

----------------------------------------------------------------------

Comment By: Bob Ippolito (etrepum)
Date: 2005-01-20 17:51

Message:
Logged In: YES 
user_id=139309

Why put this in pdb.post_mortem() if we can just put it in pdb.pm()?  
pdb.pm() seems to already be for this purpose (except it currently only 
works from the interactive interpreter as you mention).

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1106316&group_id=5470


More information about the Python-bugs-list mailing list