-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Update logging LogRecord msg attribute #9914
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
Conversation
This comment has been minimized.
This comment has been minimized.
It looks like this would be a partial revert of #1776 by @rowillia. Since there are no mypy-primer hits, it seems unlikely that too many people are passing non-str objects in this specific situation. And the inconsistency with the attribute annotation is indeed incorrect -- they should either both be |
But I'm not sure it makes sense to only do a partial revert of #1776. typeshed/stdlib/logging/__init__.pyi Lines 115 to 117 in dd2818a
But |
In the issue, you wrote:
However, the CPython docs are pretty inconsistent here: later on down in the docs, it's specifically stated that it's okay to pass non-
This seems to me like a bug in the CPython docs: they shouldn't say one thing up at the top, only to say a different thing later down. |
I hadn't really checked the other places, you're right. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since the CPython docs specifically say that it's okay to pass in arbitrary non-str
objects to the msg
parameter, I think a better fix would be to keep object
for the parameter annotation here, but change this attribute annotation so that it is also object
:
typeshed/stdlib/logging/__init__.pyi
Line 392 in dd2818a
msg: str |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you! A docs PR over at CPython would also be great. If you ping me on the PR, I can help review it :)
This comment has been minimized.
This comment has been minimized.
Co-authored-by: Alex Waygood <[email protected]>
According to mypy_primer, this change has no effect on the checked open source code. 🤖🎉 |
Closes #9913