[issue3988] Byte warning mode and b'' != ''

Christian Heimes report at bugs.python.org
Sun Sep 28 13:32:57 CEST 2008


New submission from Christian Heimes <lists at cheimes.de>:

In byte warning mode (-b or -bb command line argument) b'' == '' raises
an exception but b'' != '' doesn't.

./python -bb
>>> b'' == ''
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
BytesWarning: Comparison between bytes and string
>>> b'' != ''
True

I can't recall why I implemented the byte warning mode this way. But
nowadays I think it could hide bugs in code like "while egg != ''" where
egg is a byte instance.

----------
assignee: barry
components: Interpreter Core
messages: 73969
nosy: barry, christian.heimes
priority: release blocker
severity: normal
status: open
title: Byte warning mode and b'' != ''
type: behavior
versions: Python 3.0

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue3988>
_______________________________________


More information about the Python-bugs-list mailing list