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
BytesWarning at compile time #73523
Comments
BytesWarning can be raised during compilation. $ ./python -Wa -b -c "lambda: 'a'; lambda: b'a'"
sys:1: BytesWarning: Comparison between bytes and string
sys:1: BytesWarning: Comparison between bytes and string
sys:1: BytesWarning: Comparison between bytes and string
sys:1: BytesWarning: Comparison between bytes and string _PyCode_ConstantKey() should produce keys that don't allow comparing bytes with strings nested in tuples or frozensets. Currently it returns (tuple, ('a',), ((str, 'a'),)) for ('a',) and (tuple, (b'a',), ((bytes, b'a'),)) for (b'a',). Key tuples have the same size and the same first element. Comparing second elements emits a BytesWarning. |
Proposed patch fixes the issue. |
LGTM |
1 similar comment
LGTM |
New changeset 2bd2ef1696cf by Serhiy Storchaka in branch '3.5': New changeset f6c327f2daa6 by Serhiy Storchaka in branch '3.6': New changeset 00fb30d4905d by Serhiy Storchaka in branch 'default': |
I'm surprised that removing the type from the key works. Since tests pass, I'm happy that I spent time to write these tests, I'm now more confident |
Misc/NEWS
so that it is managed by towncrier #552Note: 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: