I'd like to propose adding the ability to extract last n stack trace entries from a traceback using functions from traceback module. Simply put, passing limit=-n would make functions to return (or print or yield) last abs(n) entries. No-brainer implementation for extract_tb:
extracted = list(_extract_tb_iter(tb, limit=(limit, None)[limit < 0])) if limit is not None and limit < 0: return extracted[limit:] return extracted
The motivation: http://stackoverflow.com/q/25472412/2301450
I like this. It's kind of sad that when the limit causes truncation of the traceback it drops the most recent frames, which might give a hint as to what happens, and keeps the oldest frames, which are usually less interesting (I know my program started at main() :-).
On Sun, Aug 24, 2014 at 10:48 AM, Thomas Allen jsbfox@gmail.com wrote:
I'd like to propose adding the ability to extract last n stack trace entries from a traceback using functions from traceback module. Simply put, passing limit=-n would make functions to return (or print or yield) last abs(n) entries. No-brainer implementation for extract_tb:
extracted = list(_extract_tb_iter(tb, limit=(limit, None)[limit < 0])) if limit is not None and limit < 0: return extracted[limit:] return extracted
The motivation: http://stackoverflow.com/q/25472412/2301450 _______________________________________________ Python-ideas mailing list Python-ideas@python.org https://mail.python.org/mailman/listinfo/python-ideas Code of Conduct: http://python.org/psf/codeofconduct/
I'm still interested in this proposal. If I write a patch, how do I go about getting it accepted?
The previous reply was wrong, sorry about that. On Aug 24, 2014 9:53 PM, "Guido van Rossum" guido@python.org wrote:
I like this. It's kind of sad that when the limit causes truncation of the traceback it drops the most recent frames, which might give a hint as to what happens, and keeps the oldest frames, which are usually less interesting (I know my program started at main() :-).
On Sun, Aug 24, 2014 at 10:48 AM, Thomas Allen jsbfox@gmail.com wrote:
I'd like to propose adding the ability to extract last n stack trace entries from a traceback using functions from traceback module. Simply put, passing limit=-n would make functions to return (or print or yield) last abs(n) entries. No-brainer implementation for extract_tb:
extracted = list(_extract_tb_iter(tb, limit=(limit, None)[limit < 0])) if limit is not None and limit < 0: return extracted[limit:] return extracted
The motivation: http://stackoverflow.com/q/25472412/2301450 _______________________________________________ Python-ideas mailing list Python-ideas@python.org https://mail.python.org/mailman/listinfo/python-ideas Code of Conduct: http://python.org/psf/codeofconduct/
-- --Guido van Rossum (python.org/~guido)
On 10/11/2014 01:34 PM, Thomas Allen wrote:
On Aug 24, 2014 9:53 PM, "Guido van Rossum" wrote:
On Sun, Aug 24, 2014 at 10:48 AM, Thomas Allen wrote:
I'd like to propose adding the ability to extract last n stack trace entries from a traceback using functions from traceback module. Simply put, passing limit=-n would make functions to return (or print or yield) last abs(n) entries.
I like this. It's kind of sad that when the limit causes truncation of the traceback it drops the most recent frames, which might give a hint as to what happens, and keeps the oldest frames, which are usually less interesting I know my program started at main() :-).
I'm still interested in this proposal. If I write a patch, how do I go about getting it accepted?
Create an issue at bugs.python.org, write your patch and submit to the issue -- if nobody takes a look within three to four weeks, ping back here or on python-dev.
-- ~Ethan~