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

SourceForge.net noreply at sourceforge.net
Thu Sep 22 10:50:01 CEST 2005


Feature Requests item #1106316, was opened at 2005-01-20 23:06
Message generated for change (Settings changed) made by birkenfeld
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=355470&aid=1106316&group_id=5470

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
>Category: Python Library
>Group: None
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: Leonardo Rochael Almeida (rochael)
Date: 2005-01-21 14:20

Message:
Logged In: YES 
user_id=200267

I don't have any particular reason to prefer post_mortem()
to pm().

The knowledgeable Python maintainers surely are better
equiped than I am to know if pm() looking beyond
sys.last_traceback is a worse break of assumptions than
post_mortem() having it's only parameter being optional or
the other way around :-)

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

Comment By: Bob Ippolito (etrepum)
Date: 2005-01-20 23: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=355470&aid=1106316&group_id=5470


More information about the Python-bugs-list mailing list