Message11060

Author jason_s
Recipients jason_s
Date 2017-02-02.02:31:28
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1486002689.86.0.756883340112.issue2547@psf.upfronthosting.co.za>
In-reply-to
Content
https://github.com/jythontools/jython/issues/54

If I do this in Jython: (tried with both 2.5.3 and 2.7.0 standalone)

import java.lang.Exception
for k in xrange(10):
   print k
if k > 3: raise java.lang.Exception("Hey")
it works fine; Jython raises a wrapped instance of java.lang.Exception. It appears to be an org.python.core.PyException. Unfortunately this class uses the default constructor of its superclass.

Why does this matter? If the object raised within Jython is a Jython object, rather than a Java exception class, it doesn't matter. But if the object raised within Jython is some Java exception object E, and Jython is embedded within a larger Java program P, then Jython doesn't allow the larger program P to use the standard Throwable.getCause() method to access the Java exception object E: it's been wrapped up opaquely, and unless the program P has special logic that knows about org.python.core.PyException and can somehow access E, it can't benefit from the information contained in E.
History
Date User Action Args
2017-02-02 02:31:29jason_ssetrecipients: + jason_s
2017-02-02 02:31:29jason_ssetmessageid: <1486002689.86.0.756883340112.issue2547@psf.upfronthosting.co.za>
2017-02-02 02:31:29jason_slinkissue2547 messages
2017-02-02 02:31:28jason_screate