[issue29337] BytesWarning at compile time
Serhiy Storchaka
report at bugs.python.org
Sat Jan 21 02:09:46 EST 2017
New submission from Serhiy Storchaka:
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.
----------
components: Interpreter Core
messages: 285940
nosy: haypo, inada.naoki, serhiy.storchaka
priority: normal
severity: normal
status: open
title: BytesWarning at compile time
type: behavior
versions: Python 3.5, Python 3.6, Python 3.7
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue29337>
_______________________________________
More information about the Python-bugs-list
mailing list