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 emily.zhao
Recipients docs@python, emily.zhao, eric.araujo, ezio.melotti, georg.brandl, lemburg, martin.panter, ncoghlan, r.david.murray
Date 2014-06-07.21:38:25
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1402177105.73.0.971695834209.issue11681@psf.upfronthosting.co.za>
In-reply-to
Content
Might be worth making this addition from 3 (I'm not sure how to add this to 2)
-b     : issue warnings about str(bytes_instance), str(bytearray_instance)
         and comparing bytes/bytearray with str. (-bb: issue errors)


Building on Martin's example:

On all of these, python2 is
Python 2.7.6 (default, Apr  6 2014, 23:14:26)
[GCC 4.2.1 Compatible Apple LLVM 5.1 (clang-503.0.38)] on darwin
Type "help", "copyright", "credits" or "license" for more information.


emily-mba:cpython emily$ python2
>>> bytearray("3") == u"3"
False

emily-mba:cpython emily$ python2 -b
>>> bytearray("3") == u"3"
__main__:1: BytesWarning: Comparison between bytearray and string
False

emily-mba:cpython emily$ python2 -bb
>>> bytearray("3") == u"3"
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
BytesWarning: Comparison between bytearray and string
History
Date User Action Args
2014-06-07 21:38:25emily.zhaosetrecipients: + emily.zhao, lemburg, georg.brandl, ncoghlan, ezio.melotti, eric.araujo, r.david.murray, docs@python, martin.panter
2014-06-07 21:38:25emily.zhaosetmessageid: <1402177105.73.0.971695834209.issue11681@psf.upfronthosting.co.za>
2014-06-07 21:38:25emily.zhaolinkissue11681 messages
2014-06-07 21:38:25emily.zhaocreate