### [issue22619] Possible implementation of negative limit for traceback functions

Serhiy Storchaka added the comment: Thank you for your contribution Dmitry. -- resolution: - fixed stage: patch review - resolved status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22619

### [issue22619] Possible implementation of negative limit for traceback functions

Roundup Robot added the comment: New changeset eb6052605fd8 by Serhiy Storchaka in branch 'default': Issue #22619: Added negative limit support in the traceback module. https://hg.python.org/cpython/rev/eb6052605fd8 -- nosy: +python-dev ___ Python

### [issue22619] Possible implementation of negative limit for traceback functions

Robert Collins added the comment: Nice, looks pretty elegant to me. I have nothing to add to the prior reviewers comments. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22619 ___

### [issue22619] Possible implementation of negative limit for traceback functions

Changes by Dmitry Kazakov jsb...@gmail.com: Added file: http://bugs.python.org/file39166/traceback_limit_doc_rev3.diff ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22619 ___

### [issue22619] Possible implementation of negative limit for traceback functions

Serhiy Storchaka added the comment: As francismb noted, there are too long lines in the patch. They should be wrapped. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22619 ___

### [issue22619] Possible implementation of negative limit for traceback functions

Dmitry Kazakov added the comment: Thanks, completely missed the abs(limit) part. Here's the updated documentation patch. -- Added file: http://bugs.python.org/file39161/traceback_limit_doc_rev.diff ___ Python tracker rep...@bugs.python.org

### [issue22619] Possible implementation of negative limit for traceback functions

Changes by Dmitry Kazakov jsb...@gmail.com: Added file: http://bugs.python.org/file39162/traceback_limit_doc_rev2.diff ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22619 ___

### [issue22619] Possible implementation of negative limit for traceback functions

Changes by Dmitry Kazakov jsb...@gmail.com: Removed file: http://bugs.python.org/file39161/traceback_limit_doc_rev.diff ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22619 ___

### [issue22619] Possible implementation of negative limit for traceback functions

Dmitry Kazakov added the comment: Here's the documentation patch. -- Added file: http://bugs.python.org/file39152/traceback_limit_doc.diff ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22619

### [issue22619] Possible implementation of negative limit for traceback functions

Dmitry Kazakov added the comment: I'll do that tomorrow. The patch still needs a review though... -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22619 ___

### [issue22619] Possible implementation of negative limit for traceback functions

Serhiy Storchaka added the comment: Needed a documentation. I'm not interested in writing it. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22619 ___

### [issue22619] Possible implementation of negative limit for traceback functions

Changes by Riley Banks waul...@gmail.com: -- nosy: +vaultah ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22619 ___ ___ Python-bugs-list mailing

### [issue22619] Possible implementation of negative limit for traceback functions

Dmitry Kazakov added the comment: Again, I'm honestly sorry if I'm being annoying, but is there anything else that needs to be done in order to make this issue resolved? The stage is set to patch review, although there were no messages posted since the latest patch was submitted and there're

### [issue22619] Possible implementation of negative limit for traceback functions

Serhiy Storchaka added the comment: Due to changes in issue17911 the patch no longer applied cleanly an should be rewritten. But changes in issue17911 are close to my patch. _tb_frame_lineno_iter matches walk_tb and _stack_frame_lineno_iter matches walk_stack. So new patch is simpler.

### [issue22619] Possible implementation of negative limit for traceback functions

Serhiy Storchaka added the comment: I proposed changed patch. It needs a review. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22619 ___ ___

### [issue22619] Possible implementation of negative limit for traceback functions

Serhiy Storchaka added the comment: Thank you for your patches Dmitry. But I think that the code can be made simpler. Here is a patch which refactors extracting code. It splits the code on few generators which do different tasks: iterate over tracebacks or frames linked list, limit the size

### [issue22619] Possible implementation of negative limit for traceback functions

Dmitry Kazakov added the comment: Thank you, Terry. You got the proposal right. I'm glad you noticed the issues with tests, I updated the patch to fix them. -- Added file: http://bugs.python.org/file37628/traceback_rev2.diff ___ Python tracker

### [issue22619] Possible implementation of negative limit for traceback functions

Changes by Dmitry Kazakov jsb...@gmail.com: Removed file: http://bugs.python.org/file37181/traceback.diff ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22619 ___

### [issue22619] Possible implementation of negative limit for traceback functions

Changes by Dmitry Kazakov jsb...@gmail.com: Removed file: http://bugs.python.org/file37341/traceback_patch_2.diff ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22619 ___

### [issue22619] Possible implementation of negative limit for traceback functions

Changes by Dmitry Kazakov jsb...@gmail.com: Removed file: http://bugs.python.org/file36919/tb_patch_2.diff ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22619 ___

### [issue22619] Possible implementation of negative limit for traceback functions

Dmitry Kazakov added the comment: I improved tests for *_stack and *_tb functions, fixed a few typos and added more comments. -- Added file: http://bugs.python.org/file37632/traceback_rev3.diff ___ Python tracker rep...@bugs.python.org

### [issue22619] Possible implementation of negative limit for traceback functions

Dmitry Kazakov added the comment: Hold on, I found 2 more bugs. Will update the patch soon. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22619 ___

### [issue22619] Possible implementation of negative limit for traceback functions

Dmitry Kazakov added the comment: Some of the patches (including the latest one) were missing Mercurial header. I'm uploading the properly formatted patch (traceback_rev_fixed.diff) -- Added file: http://bugs.python.org/file37615/traceback_rev_fixed.diff

### [issue22619] Possible implementation of negative limit for traceback functions

Terry J. Reedy added the comment: For future reference, a better initial post would have been more self-contained and explanatory, something like the following. (If I got the proposal wrong, all the more reason to explain it clearly). --- Several functions in the traceback module take a

### [issue22619] Possible implementation of negative limit for traceback functions

Changes by Serhiy Storchaka storch...@gmail.com: -- assignee: - serhiy.storchaka ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22619 ___ ___

### [issue22619] Possible implementation of negative limit for traceback functions

Dmitry Kazakov added the comment: I understand that this issue is far from being important, but this is going to be the fourth unreviewed file in this issue. I noted all your comments to me and fixed the patch accordingly, but ever since November I'm the only one who posts something here. I

### [issue22619] Possible implementation of negative limit for traceback functions

Dmitry Kazakov added the comment: Python Developer's Guide said to ping the issue, in case of one-month long inactivity period. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22619 ___

### [issue22619] Possible implementation of negative limit for traceback functions

Changes by Dmitry Kazakov jsb...@gmail.com: -- status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22619 ___ ___ Python-bugs-list

### [issue22619] Possible implementation of negative limit for traceback functions

Dmitry Kazakov added the comment: Moved the latest patch with implementation and tests from issue 22974 (http://bugs.python.org/issue22974). -- status: closed - open Added file: http://bugs.python.org/file37341/traceback_patch_2.diff ___ Python

### [issue22619] Possible implementation of negative limit for traceback functions

Dmitry Kazakov added the comment: Revisiting this issue, I realize that I made quite a few mistakes (because this was the first issue I submitted). The patch is definitely minor, and I'm no longer interested in it. This issue may now be closed. Cheers. --

### [issue22619] Possible implementation of negative limit for traceback functions

Changes by Dmitry Kazakov jsb...@gmail.com: -- status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22619 ___ ___ Python-bugs-list

### [issue22619] Possible implementation of negative limit for traceback functions

Changes by Dmitry Kazakov jsb...@gmail.com: -- status: closed - open ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22619 ___ ___ Python-bugs-list

### [issue22619] Possible implementation of negative limit for traceback functions

Dmitry Kazakov added the comment: I updated the patch. -- Added file: http://bugs.python.org/file37181/traceback.diff ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22619 ___

### [issue22619] Possible implementation of negative limit for traceback functions

Dmitry Kazakov added the comment: I'm not sure what would be the best way to support negative limit for stack functions. Actually, I think the current behavior is not intuitive. For example we could make positive limit mean the same thing for traceback and stack functions (load N entries,

### [issue22619] Possible implementation of negative limit for traceback functions

Dmitry Kazakov added the comment: I think the reason this patch hasn't been discussed well is that it only changes the behavior for traceback.*_tb functions that only deal with tracebacks. I commented on the review page that we don't have to change the behavior of traceback.*_stack functions

### [issue22619] Possible implementation of negative limit for traceback functions

R. David Murray added the comment: More likely the lack of discussion is just that Serhiy is busy :) Breaking code is to be avoided if possible. Can you give an example of the cosmetic change? I haven't fully reviewed the patch, but a more meaningful name than 'condition' might make the

### [issue22619] Possible implementation of negative limit for traceback functions

Serhiy Storchaka added the comment: Last patch is more complicated and needs more time to review. I suppose the code would be more clear if split _extract_tb_or_stack_iter() to parts. One generator just generates (filename, lineno, name, f.f_globals) tuples. Then these tuples either handled

### [issue22619] Possible implementation of negative limit for traceback functions

Dmitry Kazakov added the comment: Renamed the cond variable, added tuple unpacking instead of using a single variable. -- Added file: http://bugs.python.org/file36916/tb_patch.diff ___ Python tracker rep...@bugs.python.org

### [issue22619] Possible implementation of negative limit for traceback functions

Changes by Dmitry Kazakov jsb...@gmail.com: Removed file: http://bugs.python.org/file36916/tb_patch.diff ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22619 ___

### [issue22619] Possible implementation of negative limit for traceback functions

Changes by Dmitry Kazakov jsb...@gmail.com: -- hgrepos: +278 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22619 ___ ___ Python-bugs-list mailing

### [issue22619] Possible implementation of negative limit for traceback functions

Changes by Dmitry Kazakov jsb...@gmail.com: Added file: http://bugs.python.org/file36918/4a0ec19e4288.diff ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22619 ___

### [issue22619] Possible implementation of negative limit for traceback functions

Changes by Dmitry Kazakov jsb...@gmail.com: -- hgrepos: -278 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22619 ___ ___ Python-bugs-list mailing

### [issue22619] Possible implementation of negative limit for traceback functions

Changes by Dmitry Kazakov jsb...@gmail.com: Removed file: http://bugs.python.org/file36918/4a0ec19e4288.diff ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22619 ___

### [issue22619] Possible implementation of negative limit for traceback functions

Changes by Dmitry Kazakov jsb...@gmail.com: Added file: http://bugs.python.org/file36919/tb_patch_2.diff ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22619 ___

### [issue22619] Possible implementation of negative limit for traceback functions

Dmitry Kazakov added the comment: Here's the updated (optimized) patch -- hgrepos: +277 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22619 ___

### [issue22619] Possible implementation of negative limit for traceback functions

Changes by Dmitry Kazakov jsb...@gmail.com: Added file: http://bugs.python.org/file36899/9cb7aaad1d85.diff ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22619 ___

### [issue22619] Possible implementation of negative limit for traceback functions

Changes by Dmitry Kazakov jsb...@gmail.com: -- hgrepos: -277 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22619 ___ ___ Python-bugs-list mailing

### [issue22619] Possible implementation of negative limit for traceback functions

Changes by Dmitry Kazakov jsb...@gmail.com: -- hgrepos: -275 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22619 ___ ___ Python-bugs-list mailing

### [issue22619] Possible implementation of negative limit for traceback functions

New submission from Dmitry Kazakov: This is the possible patch for this proposal: https://mail.python.org/pipermail/python-ideas/2014-October/029826.html. -- components: Library (Lib) messages: 229167 nosy: vlth priority: normal severity: normal status: open title: Possible

### [issue22619] Possible implementation of negative limit for traceback functions

Dmitry Kazakov added the comment: def _extract_tb_or_stack_iter(curr, limit, extractor): # Distinguish frames from tracebacks (need to import types) if limit is None: limit = getattr(sys, 'tracebacklimit', None) elif limit 0 and isinstance(curr, types.TracebackType):

### [issue22619] Possible implementation of negative limit for traceback functions

Serhiy Storchaka added the comment: You forgot a patch. -- nosy: +serhiy.storchaka ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22619 ___ ___

### [issue22619] Possible implementation of negative limit for traceback functions

Dmitry Kazakov added the comment: Sorry, first time posting here; accidently pressed Enter. -- hgrepos: +275 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22619 ___

### [issue22619] Possible implementation of negative limit for traceback functions

Changes by Dmitry Kazakov jsb...@gmail.com: -- keywords: +patch Added file: http://bugs.python.org/file36891/9f618a0c2880.diff ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22619 ___

### [issue22619] Possible implementation of negative limit for traceback functions

Serhiy Storchaka added the comment: I have added comments on Retvield (a system for patch reviewing). You should receive an email about this. In general the patch is not optimal. There is no need to load source lines for dropped entries. -- ___

### [issue22619] Possible implementation of negative limit for traceback functions

Dmitry Kazakov added the comment: Thanks. I replied to your comments at Retvield. I'll update the patch tomorrow. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22619 ___