Bugs item #1106316, was opened at 2005-01-20 20:06 Message generated for change (Comment added) made by rochael 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: Leonardo Rochael Almeida (rochael) Date: 2005-01-21 11: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 20: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 _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com