Issue737978

classification
Title: IOError/java.io.Exception equivalence
Type: Severity: normal
Components: Core Versions: Jython 2.7
Milestone:
process
Status: open Resolution: remind
Dependencies: Superseder:
Assigned To: Nosy List: amak, fwierzbicki, pedronis, zyasoft
Priority: low Keywords:

Created on 2003-05-15.00:36:24 by pedronis, last changed 2015-01-14.17:09:23 by zyasoft.

Messages
msg842 (view) Author: Samuele Pedroni (pedronis) Date: 2003-05-15.00:36:24
consider

>>> from java.io import IOException as IOExc
>>> try:
...   raise IOExc
... except IOError,e:
...   try:
...    raise e
...   except IOExc,f:
...    print "IOExc as IOExc"
...    assert isinstance(f,IOExc)
...   assert isinstance(e,IOError),"broken spell"
...
IOExc as IOExc
Traceback (innermost last):
  File "<console>", line 9, in ?
AssertionError: broken spell
>>> try:
...  from java.lang import OutOfMemoryError as Boom
...  raise Boom
... except MemoryError,e:
...  assert isinstance(e,MemoryError),"broken spell"
...
Traceback (innermost last):
  File "<console>", line 5, in ?
AssertionError: broken spell

the asserts should hold

[f is e is not so relevant]
msg4193 (view) Author: Jim Baker (zyasoft) Date: 2009-03-08.06:45:15
This looks like a possible feature for 2.5.1
msg8860 (view) Author: Jim Baker (zyasoft) Date: 2014-07-01.17:53:39
Let's revisit.

There's current special casing for IOError and MemoryError in PyException#match. However, issubclass/isinstance does not work. Given that we have __subclasshook__ available in 2.7, it's now possible to adapt such errors in PyJavaType.
msg9388 (view) Author: Jim Baker (zyasoft) Date: 2015-01-14.17:09:23
Nice to have for 2.7.0 given simplicity
History
Date User Action Args
2015-01-14 17:09:23zyasoftsetresolution: remind
messages: + msg9388
2014-07-01 17:53:39zyasoftsetmessages: + msg8860
versions: + Jython 2.7
2013-02-26 19:09:48fwierzbickisetnosy: + fwierzbicki
2012-03-19 21:11:53amaksetnosy: + amak
2009-03-08 06:45:16zyasoftsetnosy: + zyasoft
messages: + msg4193
2003-05-15 00:36:24pedroniscreate