-
-
Notifications
You must be signed in to change notification settings - Fork 31.7k
traceback module has no way to show locals #67125
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
From testing-cabal/testtools#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). |
See http://bugs.python.org/issue22936 for the unittest aspect of this. |
Check out the cgitb stdlib module. |
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. |
updated with the latest 17911 patch basis. |
And now updated to HEAD as 17911 has been committed. |
Latest patch (issue-22936-4.patch) looks good to me! |
New changeset 50741316dd3a by Robert Collins in branch 'default': |
In the patch you made some args kw-only. |
It's only the new APIs just introduced in issue bpo-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. |
You are right -- I didn't notice the versionadded in the docs. |
No worries. BTW there is one more patch needed to close this issue - adding the feature to unittest. I'm working that up now. |
And the unittest patch. |
New changeset b4a26b28f5b3 by Robert Collins in branch 'default': |
I just filed issue bpo-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. |
msg237320 "...so I'm *NOT* entirely convinced..."? :) |
This itself is fixed. |
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: