This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author serhiy.storchaka
Recipients methane, serhiy.storchaka, vstinner
Date 2017-01-21.07:09:46
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1484982586.78.0.422468246503.issue29337@psf.upfronthosting.co.za>
In-reply-to
Content
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.
History
Date User Action Args
2017-01-21 07:09:46serhiy.storchakasetrecipients: + serhiy.storchaka, vstinner, methane
2017-01-21 07:09:46serhiy.storchakasetmessageid: <1484982586.78.0.422468246503.issue29337@psf.upfronthosting.co.za>
2017-01-21 07:09:46serhiy.storchakalinkissue29337 messages
2017-01-21 07:09:46serhiy.storchakacreate