[issue11681] -b option undocumented

2017-05-13 Thread Zachary Ware
Zachary Ware added the comment: Thanks for the patch, Greg! I implemented Nick's suggestions and merged it. -- resolution: -> fixed stage: needs patch -> resolved status: open -> closed ___ Python tracker ___

[issue11681] -b option undocumented

2017-05-13 Thread Zachary Ware
Zachary Ware added the comment: New changeset f6c6d1e2304a06efdf65c60c3e1c6bbe1f192fd0 by Zachary Ware in branch '2.7': bpo-11681: Document the `-b` and `-bb` options (GH-1562) https://github.com/python/cpython/commit/f6c6d1e2304a06efdf65c60c3e1c6bbe1f192fd0 -- nosy: +zach.ware _

[issue11681] -b option undocumented

2017-05-12 Thread Zachary Ware
Changes by Zachary Ware : -- pull_requests: +1660 ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.

[issue11681] -b option undocumented

2017-01-12 Thread Greg Bengeult
Greg Bengeult added the comment: Thanks for the :class: markup edits. I'm still learning this stuff. -- ___ Python tracker ___ ___ Pyt

[issue11681] -b option undocumented

2017-01-11 Thread Nick Coghlan
Nick Coghlan added the comment: Added some review comments on the patch. The only critical one was changing a :class:`bytes` reference to :class:`unicode`, but I also suggested it may be worth mentioning that it *doesn't* enable warnings about all binary/text comparisons the way the Python 3 o

[issue11681] -b option undocumented

2017-01-11 Thread Nick Coghlan
Nick Coghlan added the comment: Right, the lack of transitivity comes from the fact that: >>> u"3" == str(3) True Is really shorthand for: >>> u"3" == str(3).decode("ascii") True However, the implicit decoding only triggers for *exactly* bytes instances, so in the bytearray c

[issue11681] -b option undocumented

2017-01-11 Thread Greg Bengeult
Greg Bengeult added the comment: I have attached a patch for 2.7 that adds -b and -bb to the command line documentation in Modules/main.c and Doc/library/cmdline.rst, following the suggested text provided by Martin. Interestingly, unicode(), bytearray(), and str() don't seem to be transitive i

[issue11681] -b option undocumented

2016-10-29 Thread Martin Panter
Martin Panter added the comment: As well as the usage string, it is missing from the list of options in the main documentation at Doc/using/cmdline.rst. There are a couple of places (sys.rst and warnings.rst) that reference :option:`-b`, and newer versions of Sphinx complain about this. -

[issue11681] -b option undocumented

2014-06-08 Thread Arfrever Frehtes Taifersar Arahesis
Changes by Arfrever Frehtes Taifersar Arahesis : -- nosy: +Arfrever ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscri

[issue11681] -b option undocumented

2014-06-07 Thread Martin Panter
Martin Panter added the comment: Trouble is, in Python 2 bytes() and str() are the same thing, and most of those conditions don’t apply. Maybe something like this is more correct: -b : issue warnings about comparing bytearray with unicode. (-bb: issue errors) -- _

[issue11681] -b option undocumented

2014-06-07 Thread Emily Zhao
Emily Zhao added the comment: Here's an attempt (based on 3's main.c http://hg.python.org/cpython/file/8866ac6f2269/Modules/main.c) -- keywords: +patch Added file: http://bugs.python.org/file35528/issue11681.patch ___ Python tracker

[issue11681] -b option undocumented

2014-06-07 Thread Emily Zhao
Emily Zhao added the comment: 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 t

[issue11681] -b option undocumented

2014-01-04 Thread Martin Panter
Martin Panter added the comment: Try this to trigger a warning: python2 -b -c 'bytearray("3") == u"3"' -c:1: BytesWarning: Comparison between bytearray and string -- nosy: +vadmium ___ Python tracker _

[issue11681] -b option undocumented

2014-01-04 Thread moijes12
Changes by moijes12 : -- nosy: -moijes12 ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.o

[issue11681] -b option undocumented

2012-06-26 Thread moijes12
moijes12 added the comment: Hi Marc I tried reproducing this for bytearray using Python 2.7.2 but I can't see a warning. devel@moses:~$ python --version Python 2.7.2+ devel@moses:~$ cat test_py.py k = range(10) kb = bytearray(k) print kb kb = bytearray("hi") print kb devel@moses:~$ python -b

[issue11681] -b option undocumented

2011-03-27 Thread Marc-Andre Lemburg
Marc-Andre Lemburg added the comment: Nick Coghlan wrote: > > Nick Coghlan added the comment: > > Even "from __future__ import unicode_literals" doesn't make it do anything. > > Perhaps Christian merged it by mistake in [5341b30b1812]? It looks more like some parts were left out in the merg

[issue11681] -b option undocumented

2011-03-27 Thread Nick Coghlan
Nick Coghlan added the comment: Even "from __future__ import unicode_literals" doesn't make it do anything. Perhaps Christian merged it by mistake in [5341b30b1812]? -- nosy: +ncoghlan ___ Python tracker

[issue11681] -b option undocumented

2011-03-26 Thread Ezio Melotti
Changes by Ezio Melotti : -- nosy: +ezio.melotti ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.py

[issue11681] -b option undocumented

2011-03-25 Thread Éric Araujo
Éric Araujo added the comment: test_bytes has a branch for -b and passes without it, with -b and with -bb. I really don’t know. -- ___ Python tracker ___ _

[issue11681] -b option undocumented

2011-03-25 Thread R. David Murray
R. David Murray added the comment: rdmurray@hey:~/python/p27>cat temp.py x = bytes('abc') print x print str(x) rdmurray@hey:~/python/p27>./python -bb temp.py abc abc -- ___ Python tracker _

[issue11681] -b option undocumented

2011-03-25 Thread Éric Araujo
Éric Araujo added the comment: The code definitely is in 2.7. Python/_warnings.c:861:if (Py_BytesWarningFlag > 1) Python/_warnings.c:863:else if (Py_BytesWarningFlag) Python/_warnings.c:867:PyList_SET_ITEM(filters, pos++, create_filter(PyExc_BytesWarning, Python/sysmodule.c:1257:

[issue11681] -b option undocumented

2011-03-25 Thread R. David Murray
R. David Murray added the comment: Are you sure? (see issue 10471). I don't see how -b could do anything in python2, since bytes and string are the same there (and, indeed, from command line experimentation it doesn't seem to). -- nosy: +r.david.murray _

[issue11681] -b option undocumented

2011-03-25 Thread Éric Araujo
New submission from Éric Araujo : Python 2 has a -b command-line option which is undocumented. It is used by the warnings machinery to decide to warn about (-b) or raise an error (-bb) if someone uses str(bytes) or str(buffer) (explanation courtesy of grep and Python/pythonrun.c). --