Issue1906

classification
Title: DeprecationWarnings, ImportWarnings and PendingDeprecationWarnings do not work in Jython 2.7
Type: Severity: normal
Components: Versions: Jython 2.7
Milestone: Jython 2.7.2
process
Status: open Resolution:
Dependencies: Superseder:
Assigned To: fwierzbicki Nosy List: Arfrever, fwierzbicki, jeff.allen, tebeka
Priority: normal Keywords:

Created on 2012-05-30.01:57:14 by Arfrever, last changed 2015-12-29.23:53:58 by zyasoft.

Messages
msg7170 (view) Author: Arfrever Frehtes Taifersar Arahesis (Arfrever) Date: 2012-05-30.01:57:13
Short -W* options don't work in Jython. Warnings don't work at all in Jython 2.7 (regression).

$ python2.7 -Wd -c 'import md5'
-c:1: DeprecationWarning: the md5 module is deprecated; use hashlib instead
$ python2.7 -Wdefault -c 'import md5'
-c:1: DeprecationWarning: the md5 module is deprecated; use hashlib instead
$ jython2.7 -Wd -c 'import md5'
Invalid -W option ignored: invalid action: 'd'
$ jython2.7 -Wdefault -c 'import md5'
$ jython2.5 -c 'import warnings; warnings.warn("Some warning", DeprecationWarning)'
-c:1: DeprecationWarning: Some warning
$ jython2.7 -c 'import warnings; warnings.warn("Some warning", DeprecationWarning)'
$ jython2.7 -Wdefault -c 'import warnings; warnings.warn("Some warning", DeprecationWarning)'
$
msg7174 (view) Author: Arfrever Frehtes Taifersar Arahesis (Arfrever) Date: 2012-05-31.00:13:49
Actually only DeprecationWarnings, ImportWarnings and PendingDeprecationWarnings do not work:

$ jython2.7 -Wdefault
>>> import __builtin__, warnings
>>> for name in dir(__builtin__):
...   if name.endswith("Warning"):
...     print(name)
...     warnings.warn("Some warning", getattr(__builtin__, name))
... 
BytesWarning
__main__:4: BytesWarning: Some warning
DeprecationWarning
FutureWarning
__main__:4: FutureWarning: Some warning
ImportWarning
PendingDeprecationWarning
RuntimeWarning
__main__:4: RuntimeWarning: Some warning
SyntaxWarning
__main__:4: SyntaxWarning: Some warning
UnicodeWarning
__main__:4: UnicodeWarning: Some warning
UserWarning
__main__:4: UserWarning: Some warning
Warning
__main__:4: Warning: Some warning
>>>
msg7196 (view) Author: Arfrever Frehtes Taifersar Arahesis (Arfrever) Date: 2012-06-08.22:53:26
(Support for short -W options moved to issue #1913.)
msg7242 (view) Author: Frank Wierzbicki (fwierzbicki) Date: 2012-06-18.20:40:13
Since support for #1913 has been moved and the rest of this bug (warnings doesn't work) is fixed (thanks Miki Tebeka!), closing.
msg7243 (view) Author: Arfrever Frehtes Taifersar Arahesis (Arfrever) Date: 2012-06-18.21:00:26
DeprecationWarnings, ImportWarnings and PendingDeprecationWarnings still do not work.
msg7244 (view) Author: Frank Wierzbicki (fwierzbicki) Date: 2012-06-18.21:30:33
oops, reopening - do you have examples of these failures? I have to admit I haven't used warnings myself.
msg7245 (view) Author: Arfrever Frehtes Taifersar Arahesis (Arfrever) Date: 2012-06-18.21:49:02
Jython 2.7 (revision bfb99e7c29be):

$ jython2.7 -Walways -c 'import warnings; warnings.warn("Some warning", DeprecationWarning)'
$ jython2.7 -Walways -c 'import warnings; warnings.warn("Some warning", RuntimeWarning)'
-c:1: RuntimeWarning: Some warning

CPython 2.7:

$ python2.7 -Walways -c 'import warnings; warnings.warn("Some warning", DeprecationWarning)'
-c:1: DeprecationWarning: Some warning
$ python2.7 -Walways -c 'import warnings; warnings.warn("Some warning", RuntimeWarning)'
-c:1: RuntimeWarning: Some warning

Also see message 7174.
msg7246 (view) Author: Frank Wierzbicki (fwierzbicki) Date: 2012-06-18.22:28:00
Ah got it - it looks like our ignore mechanism might be a little too enthusiastic
History
Date User Action Args
2015-12-29 23:53:58zyasoftsetmilestone: Jython 2.7.1 -> Jython 2.7.2
2015-05-10 15:59:03jeff.allensetnosy: + jeff.allen
2015-04-23 16:33:32zyasoftsetmilestone: Jython 2.7.1
2013-02-25 18:21:32fwierzbickisetpriority: normal
2013-02-25 18:21:23fwierzbickisetversions: + Jython 2.7
2012-06-18 22:28:00fwierzbickisetmessages: + msg7246
2012-06-18 21:49:02Arfreversetmessages: + msg7245
2012-06-18 21:30:33fwierzbickisetstatus: closed -> open
resolution: fixed ->
messages: + msg7244
2012-06-18 21:00:26Arfreversetmessages: + msg7243
2012-06-18 20:40:14fwierzbickisetstatus: open -> closed
assignee: fwierzbicki
resolution: fixed
messages: + msg7242
nosy: + fwierzbicki
2012-06-08 22:53:26Arfreversetmessages: + msg7196
2012-05-31 00:21:31Arfreversetnosy: + tebeka
2012-05-31 00:13:50Arfreversetmessages: + msg7174
title: Warnings do not work in Jython 2.7 -> DeprecationWarnings, ImportWarnings and PendingDeprecationWarnings do not work in Jython 2.7
2012-05-30 01:57:14Arfrevercreate