[issue20361] -W command line options and PYTHONWARNINGS environmental variable should not override -b / -bb command line options

Arfrever Frehtes Taifersar Arahesis report at bugs.python.org
Thu Jan 23 10:19:49 CET 2014


New submission from Arfrever Frehtes Taifersar Arahesis:

Currently -W command line options and PYTHONWARNINGS environmental variable non-intuitively override settings specified by -b / -bb command line options.

$ python3.4 -c 'print("" == b"")'
False
$ python3.4 -b -c 'print("" == b"")'
-c:1: BytesWarning: Comparison between bytes and string
False
$ python3.4 -bb -c 'print("" == b"")'
Traceback (most recent call last):
  File "<string>", line 1, in <module>
BytesWarning: Comparison between bytes and string
$ python3.4 -We -b -c 'print("" == b"")'
Traceback (most recent call last):
  File "<string>", line 1, in <module>
BytesWarning: Comparison between bytes and string
$ python3.4 -Wd -bb -c 'print("" == b"")'
-c:1: BytesWarning: Comparison between bytes and string
False
$ python3.4 -Wi -b -c 'print("" == b"")'
False
$ python3.4 -Wi -bb -c 'print("" == b"")'
False
$


I suggest to increase priority of -b / -bb command line options.
The attached patch should be applied after patch from issue #20355.

(Test suite of Python triggers some BytesWarnings, so firstly they will have to be fixed.)

----------
components: Interpreter Core
files: python-bytes_warnings.patch
keywords: patch
messages: 208894
nosy: Arfrever, barry, brett.cannon, brian.curtin, eric.araujo, larry, pitrou, pjenvey, skrah
priority: normal
severity: normal
status: open
title: -W command line options and PYTHONWARNINGS environmental variable should not override -b / -bb command line options
type: behavior
versions: Python 3.4
Added file: http://bugs.python.org/file33648/python-bytes_warnings.patch

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


More information about the Python-bugs-list mailing list