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.

Author ncoghlan
Recipients gvanrossum, ncoghlan, pitrou
Date 2013-05-07.01:42:05
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1367890925.73.0.216938615603.issue17911@psf.upfronthosting.co.za>
In-reply-to
Content
Antoine - I like your idea, but I think it's a separate issue. I agree with Guido that exposing some lower level non-formatting APIs in the traceback module would be helpful.

I see Guido's suggestion here as similar to the change we just made in the dis module to expose a dis.get_instructions iterator. That change makes it much easier to work with the disassembler output programmatically, whereas the module was previously too focused on displaying text with a specific format.

My current thoughts: define a "TracebackSummary" with the following fields:

    exc_type
    exc_repr
    stack_summary
    cause
    context

stack_summary would be a list of (filename, lineno, functionname) triples as Guido suggested (probably a named tuple)

cause and context would be either None or a reference to an appropriate TracebackSummary object

Basically, the summary should contain all of the information needed to create the formatted traceback output, without actually doing any formatting (aside from calling repr() on the exception)
History
Date User Action Args
2013-05-07 01:42:05ncoghlansetrecipients: + ncoghlan, gvanrossum, pitrou
2013-05-07 01:42:05ncoghlansetmessageid: <1367890925.73.0.216938615603.issue17911@psf.upfronthosting.co.za>
2013-05-07 01:42:05ncoghlanlinkissue17911 messages
2013-05-07 01:42:05ncoghlancreate