Issue 22936: traceback module has no way to show locals (original) (raw)

Created on 2014-11-25 02:05 by rbcollins, last changed 2022-04-11 14:58 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
issue-22936-1.patch rbcollins,2015-01-26 23:48
issue-22936-2.patch rbcollins,2015-02-03 23:29
issue-22936-3.patch rbcollins,2015-03-04 23:23 review
issue-22936-4.patch rbcollins,2015-03-05 06:37 review
issue-22936-5.patch rbcollins,2015-03-06 00:18 review
Messages (17)
msg231628 - (view) Author: Robert Collins (rbcollins) * (Python committer) Date: 2014-11-25 02:05
From https://github.com/testing-cabal/testtools/issues/111 - any code that is data dependent can be hard to diagnose from a backtrace alone. Many unittest and server environments address this by doing custom tracebacks that include locals. To address this in unittest, we need to add a similar capacity to traceback, and then use it from unittest (as we can't just depend on a module from PyPI in the stdlib).
msg231630 - (view) Author: Robert Collins (rbcollins) * (Python committer) Date: 2014-11-25 02:07
See http://bugs.python.org/issue22936 for the unittest aspect of this.
msg231738 - (view) Author: Guido van Rossum (gvanrossum) * (Python committer) Date: 2014-11-27 00:03
Check out the cgitb stdlib module.
msg234799 - (view) Author: Robert Collins (rbcollins) * (Python committer) Date: 2015-01-26 23:48
First cut implementation. I'm sure there is lots we can add, but this will make things nicer in and of itself. Thanks for the pointer to cgitb, I've skimmed it and its definitely much more comprehensive. I'm not entirely sure about the best way to glue it and the new traceback API together; or even if thats needed.
msg235366 - (view) Author: Robert Collins (rbcollins) * (Python committer) Date: 2015-02-03 23:29
updated with the latest 17911 patch basis.
msg237218 - (view) Author: Robert Collins (rbcollins) * (Python committer) Date: 2015-03-04 23:14
And now updated to HEAD as 17911 has been committed.
msg237243 - (view) Author: Alyssa Coghlan (ncoghlan) * (Python committer) Date: 2015-03-05 06:48
Latest patch (issue-22936-4.patch) looks good to me!
msg237244 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2015-03-05 07:29
New changeset 50741316dd3a by Robert Collins in branch 'default': Issue #22936: Make it possible to show local variables in tracebacks. https://hg.python.org/cpython/rev/50741316dd3a
msg237246 - (view) Author: Ezio Melotti (ezio.melotti) * (Python committer) Date: 2015-03-05 08:07
In the patch you made some args kw-only. Isn't that backward incompatible in case someone was passing them by position?
msg237262 - (view) Author: Alyssa Coghlan (ncoghlan) * (Python committer) Date: 2015-03-05 14:06
It's only the new APIs just introduced in issue #17911 that changed to kwonly arguments. We missed that they should really be kwonly in the original review, but it become more obvious in this patch, as it added a second feature toggle to indicate whether or not to capture the locals.
msg237267 - (view) Author: Ezio Melotti (ezio.melotti) * (Python committer) Date: 2015-03-05 15:08
You are right -- I didn't notice the versionadded in the docs. Sorry for the noise.
msg237298 - (view) Author: Robert Collins (rbcollins) * (Python committer) Date: 2015-03-05 22:39
No worries. BTW there is one more patch needed to close this issue - adding the feature to unittest. I'm working that up now.
msg237308 - (view) Author: Robert Collins (rbcollins) * (Python committer) Date: 2015-03-06 00:02
And the unittest patch.
msg237314 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2015-03-06 00:46
New changeset b4a26b28f5b3 by Robert Collins in branch 'default': Issue #22936: Allow showing local variables in unittest errors. https://hg.python.org/cpython/rev/b4a26b28f5b3
msg237320 - (view) Author: Alyssa Coghlan (ncoghlan) * (Python committer) Date: 2015-03-06 02:15
I just filed issue #23597 as a potential further follow-up to this, which would be to also add support for displaying local variables directly to the logging module. However, that has some additional security implications, so I'm entirely convinced it's a good idea yet. See the new RFE for more details.
msg237326 - (view) Author: Mark Lawrence (BreamoreBoy) * Date: 2015-03-06 02:36
"...so I'm *NOT* entirely convinced..."? :)
msg249169 - (view) Author: Robert Collins (rbcollins) * (Python committer) Date: 2015-08-26 00:13
This itself is fixed.
History
Date User Action Args
2022-04-11 14:58:10 admin set github: 67125
2015-08-26 00:13:03 rbcollins set status: open -> closedresolution: fixedmessages: + stage: resolved
2015-03-21 04:16:48 r.david.murray set nosy: + n
2015-03-21 04:16:33 r.david.murray link issue23724 superseder
2015-03-06 02:36:33 BreamoreBoy set nosy: + BreamoreBoymessages: +
2015-03-06 02:15:06 ncoghlan set dependencies: + traceback: add a new thin class storing a traceback without storing local variablesmessages: +
2015-03-06 02:13:00 ncoghlan link issue23597 dependencies
2015-03-06 00:46:55 python-dev set messages: +
2015-03-06 00:23:41 gvanrossum set nosy: - gvanrossum
2015-03-06 00🔞58 rbcollins set files: + issue-22936-5.patch
2015-03-06 00🔞28 rbcollins set files: - issue-22936-5.patch
2015-03-06 00:02:50 rbcollins set files: + issue-22936-5.patchmessages: +
2015-03-05 22:39:29 rbcollins set messages: +
2015-03-05 15:08:35 ezio.melotti set messages: +
2015-03-05 14:07:00 ncoghlan set messages: +
2015-03-05 08:07:47 ezio.melotti set nosy: + ezio.melottimessages: +
2015-03-05 07:29:31 python-dev set nosy: + python-devmessages: +
2015-03-05 06:48:49 ncoghlan set nosy: + ncoghlanmessages: +
2015-03-05 06:37:55 rbcollins set files: + issue-22936-4.patch
2015-03-04 23:23:14 rbcollins set files: + issue-22936-3.patch
2015-03-04 23:23:05 rbcollins set files: - issue-22936-3.patch
2015-03-04 23:14:22 rbcollins set files: + issue-22936-3.patchmessages: +
2015-02-03 23:29:22 rbcollins set files: + issue-22936-2.patchmessages: +
2015-01-26 23:48:17 rbcollins set files: + issue-22936-1.patchkeywords: + patchmessages: +
2014-11-28 18:07:22 cvrebert set nosy: + cvrebert
2014-11-27 00:03:34 gvanrossum set nosy: + gvanrossummessages: +
2014-11-25 02:07:00 rbcollins set messages: +
2014-11-25 02:06:34 rbcollins set type: enhancement
2014-11-25 02:05:27 rbcollins create