-
-
Notifications
You must be signed in to change notification settings - Fork 225
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
Better support for missing __name__ in frame traversal #58
Conversation
Current coverage is
|
See-Also, Mozilla Bug 1192021 (comment # 11) |
Nice edge case, thanks! I can't release it before next week tho because I'm on a vacation and I don't have my notebook on me. You can use the time to add yourself to authors. :) |
Oh and please add a test case for your exact use case, thanks! |
Also fixes _frame tests with "SyntaxWarning: assertion is always true, perhaps remove parentheses?" And lastly add me to Authors.
How's that? |
casual nudge. :-) |
Sorry, first weeks are crazy. :) |
Oops can you rebase/merge forward please? |
The conflict is from your py3.5 release notes change... but sure... |
...merged in master |
Better support for missing __name__ in frame traversal
FYI, 15.3.0 with this change is out. Thank you for your contribution: https://pypi.python.org/pypi/structlog/15.3.0 |
In my own code, I got a new traceback for this issue (meant to be fixed in release of 15.1.0)
With some DEBUG prints sprinkled in, I was able to see that
f.f_frame.has_key("__name__")
wasTrue
, howeverf.f_frame.get("__name__", "?")
would still returnNone
thus skipping that default choice.Per python docs,
foo.get("whatever")
already has a default value ofNone
so simply mixing them with "or" will achieve the desired goal here in all existing cases, as well as fix my own case.For reference the full traceback I had:
If this patch is accepted, I would appreciate a new structlog release, sooner than later.