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

SourceForge.net noreply at sourceforge.net
Thu Jan 20 23:06:52 CET 2005


Bugs item #1106316, was opened at 2005-01-20 20:06
Message generated for change (Tracker Item Submitted) made by Item Submitter
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...

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

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