[New-bugs-announce] [issue20355] -W command line options should have higher priority than PYTHONWARNINGS environmental variable

Arfrever Frehtes Taifersar Arahesis report at bugs.python.org
Wed Jan 22 22:41:46 CET 2014


New submission from Arfrever Frehtes Taifersar Arahesis:

Currently Python has non-intuitive behavior such that PYTHONWARNINGS environmental variable has higher priority than -W command line options.

$ python3.4 -c '__import__("warnings").warn("xxx", DeprecationWarning)'
$ python3.4 -Wd -c '__import__("warnings").warn("xxx", DeprecationWarning)'
-c:1: DeprecationWarning: xxx
$ python3.4 -We -c '__import__("warnings").warn("xxx", DeprecationWarning)'
Traceback (most recent call last):
  File "<string>", line 1, in <module>
DeprecationWarning: xxx
$ PYTHONWARNINGS="e" python3.4 -Wd -c '__import__("warnings").warn("xxx", DeprecationWarning)'
Traceback (most recent call last):
  File "<string>", line 1, in <module>
DeprecationWarning: xxx
$ PYTHONWARNINGS="d" python3.4 -We -c '__import__("warnings").warn("xxx", DeprecationWarning)'
-c:1: DeprecationWarning: xxx
$


I think that settings from -W command line options should have higher priority than PYTHONWARNINGS environmental variable.

(Adding people from issue #7301 to nosy list.)

----------
components: Interpreter Core
messages: 208854
nosy: Arfrever, barry, brian.curtin, eric.araujo, pitrou, pjenvey, skrah
priority: normal
severity: normal
status: open
title: -W command line options should have higher priority than PYTHONWARNINGS environmental variable
type: behavior
versions: Python 2.7, Python 3.3, Python 3.4

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


More information about the New-bugs-announce mailing list