From jython-checkins at python.org Wed Jan 3 11:47:50 2018 From: jython-checkins at python.org (jeff.allen) Date: Wed, 03 Jan 2018 16:47:50 +0000 Subject: [Jython-checkins] =?utf-8?q?jython=3A_Fix_=232403=2C_VerifyError?= =?utf-8?q?_when_implementing_interface_default_methods?= Message-ID: <20180103164750.1.C1165436416587D6@mg.python.org> https://hg.python.org/jython/rev/f842e0a9d903 changeset: 8149:f842e0a9d903 user: James Mudd date: Wed Jan 03 15:08:10 2018 +0000 summary: Fix #2403, VerifyError when implementing interface default methods files: NEWS | 3 +++ src/org/python/compiler/ClassFile.java | 2 +- 2 files changed, 4 insertions(+), 1 deletions(-) diff --git a/NEWS b/NEWS --- a/NEWS +++ b/NEWS @@ -2,6 +2,9 @@ For more details, please see https://hg.python.org/jython + Developement tip + - [ 2403 ] VerifyError when implementing interfaces containing default methods (Java 8) + Jython 2.7.2a1 Bugs fixed - [ 2632 ] Handle unicode data appropriately in csv module diff --git a/src/org/python/compiler/ClassFile.java b/src/org/python/compiler/ClassFile.java --- a/src/org/python/compiler/ClassFile.java +++ b/src/org/python/compiler/ClassFile.java @@ -239,7 +239,7 @@ } } catch (Exception fe) {} } - cw.visit(Opcodes.V1_5, Opcodes.ACC_PUBLIC + Opcodes.ACC_SUPER, this.name, null, this.superclass, interfaces); + cw.visit(Opcodes.V1_6, Opcodes.ACC_PUBLIC + Opcodes.ACC_SUPER, this.name, null, this.superclass, interfaces); AnnotationVisitor av = cw.visitAnnotation("Lorg/python/compiler/APIVersion;", true); // XXX: should imp.java really house this value or should imp.java point into // org.python.compiler? -- Repository URL: https://hg.python.org/jython From jython-checkins at python.org Wed Jan 3 11:47:50 2018 From: jython-checkins at python.org (jeff.allen) Date: Wed, 03 Jan 2018 16:47:50 +0000 Subject: [Jython-checkins] =?utf-8?q?jython=3A_Add_shadowstr=2Ederived?= Message-ID: <20180103164750.1.4FB09CD5BE484273@mg.python.org> https://hg.python.org/jython/rev/7703a48ade07 changeset: 8148:7703a48ade07 user: Jeff Allen date: Tue Jan 02 14:09:30 2018 +0000 summary: Add shadowstr.derived Also correct line-endings to Unix-LF in the .java file. files: src/org/python/core/PyShadowStringDerived.java | 2324 +++++----- src/templates/shadowstr.derived | 5 + 2 files changed, 1167 insertions(+), 1162 deletions(-) diff --git a/src/org/python/core/PyShadowStringDerived.java b/src/org/python/core/PyShadowStringDerived.java --- a/src/org/python/core/PyShadowStringDerived.java +++ b/src/org/python/core/PyShadowStringDerived.java @@ -1,1162 +1,1162 @@ -/* Generated file, do not modify. See jython/src/templates/gderived.py. */ -package org.python.core; - -import java.io.Serializable; -import org.python.core.finalization.FinalizeTrigger; -import org.python.core.finalization.FinalizablePyObjectDerived; - -public class PyShadowStringDerived extends PyShadowString implements Slotted,FinalizablePyObjectDerived,TraverseprocDerived { - - public PyObject getSlot(int index) { - return slots[index]; - } - - public void setSlot(int index,PyObject value) { - slots[index]=value; - } - - private PyObject[]slots; - - public void __del_derived__() { - PyType self_type=getType(); - PyObject impl=self_type.lookup("__del__"); - if (impl!=null) { - impl.__get__(this,self_type).__call__(); - } - } - - public void __ensure_finalizer__() { - FinalizeTrigger.ensureFinalizer(this); - } - - /* TraverseprocDerived implementation */ - public int traverseDerived(Visitproc visit,Object arg) { - int retVal; - for(int i=0;i0?1:0; - } - - public boolean __nonzero__() { - PyType self_type=getType(); - PyObject impl=self_type.lookup("__nonzero__"); - if (impl==null) { - impl=self_type.lookup("__len__"); - if (impl==null) - return super.__nonzero__(); - } - PyObject o=impl.__get__(this,self_type).__call__(); - Class c=o.getClass(); - if (c!=PyInteger.class&&c!=PyBoolean.class) { - throw Py.TypeError(String.format("__nonzero__ should return bool or int, returned %s",self_type.getName())); - } - return o.__nonzero__(); - } - - public boolean __contains__(PyObject o) { - PyType self_type=getType(); - PyObject impl=self_type.lookup("__contains__"); - if (impl==null) - return super.__contains__(o); - return impl.__get__(this,self_type).__call__(o).__nonzero__(); - } - - public int __len__() { - PyType self_type=getType(); - PyObject impl=self_type.lookup("__len__"); - if (impl!=null) { - PyObject res=impl.__get__(this,self_type).__call__(); - return res.asInt(); - } - return super.__len__(); - } - - public PyObject __iter__() { - PyType self_type=getType(); - PyObject impl=self_type.lookup("__iter__"); - if (impl!=null) - return impl.__get__(this,self_type).__call__(); - impl=self_type.lookup("__getitem__"); - if (impl==null) - return super.__iter__(); - return new PySequenceIter(this); - } - - public PyObject __iternext__() { - PyType self_type=getType(); - PyObject impl=self_type.lookup("next"); - if (impl!=null) { - try { - return impl.__get__(this,self_type).__call__(); - } catch (PyException exc) { - if (exc.match(Py.StopIteration)) - return null; - throw exc; - } - } - return super.__iternext__(); // ??? - } - - public PyObject __finditem__(PyObject key) { // ??? - PyType self_type=getType(); - PyObject impl=self_type.lookup("__getitem__"); - if (impl!=null) - try { - return impl.__get__(this,self_type).__call__(key); - } catch (PyException exc) { - if (exc.match(Py.LookupError)) - return null; - throw exc; - } - return super.__finditem__(key); - } - - public PyObject __finditem__(int key) { - PyType self_type=getType(); - PyObject impl=self_type.lookup("__getitem__"); - if (impl!=null) - try { - return impl.__get__(this,self_type).__call__(new PyInteger(key)); - } catch (PyException exc) { - if (exc.match(Py.LookupError)) - return null; - throw exc; - } - return super.__finditem__(key); - } - - public PyObject __getitem__(PyObject key) { - // Same as __finditem__, without swallowing LookupErrors. This allows - // __getitem__ implementations written in Python to raise custom - // exceptions (such as subclasses of KeyError). - // - // We are forced to duplicate the code, instead of defining __finditem__ - // in terms of __getitem__. That's because PyObject defines __getitem__ - // in terms of __finditem__. Therefore, we would end with an infinite - // loop when self_type.lookup("__getitem__") returns null: - // - // __getitem__ -> super.__getitem__ -> __finditem__ -> __getitem__ - // - // By duplicating the (short) lookup and call code, we are safe, because - // the call chains will be: - // - // __finditem__ -> super.__finditem__ - // - // __getitem__ -> super.__getitem__ -> __finditem__ -> super.__finditem__ - - PyType self_type=getType(); - PyObject impl=self_type.lookup("__getitem__"); - if (impl!=null) - return impl.__get__(this,self_type).__call__(key); - return super.__getitem__(key); - } - - public void __setitem__(PyObject key,PyObject value) { // ??? - PyType self_type=getType(); - PyObject impl=self_type.lookup("__setitem__"); - if (impl!=null) { - impl.__get__(this,self_type).__call__(key,value); - return; - } - super.__setitem__(key,value); - } - - public PyObject __getslice__(PyObject start,PyObject stop,PyObject step) { // ??? - if (step!=null) { - return __getitem__(new PySlice(start,stop,step)); - } - PyType self_type=getType(); - PyObject impl=self_type.lookup("__getslice__"); - if (impl!=null) { - PyObject[]indices=PySlice.indices2(this,start,stop); - return impl.__get__(this,self_type).__call__(indices[0],indices[1]); - } - return super.__getslice__(start,stop,step); - } - - public void __setslice__(PyObject start,PyObject stop,PyObject step,PyObject value) { - if (step!=null) { - __setitem__(new PySlice(start,stop,step),value); - return; - } - PyType self_type=getType(); - PyObject impl=self_type.lookup("__setslice__"); - if (impl!=null) { - PyObject[]indices=PySlice.indices2(this,start,stop); - impl.__get__(this,self_type).__call__(indices[0],indices[1],value); - return; - } - super.__setslice__(start,stop,step,value); - } - - public void __delslice__(PyObject start,PyObject stop,PyObject step) { - if (step!=null) { - __delitem__(new PySlice(start,stop,step)); - return; - } - PyType self_type=getType(); - PyObject impl=self_type.lookup("__delslice__"); - if (impl!=null) { - PyObject[]indices=PySlice.indices2(this,start,stop); - impl.__get__(this,self_type).__call__(indices[0],indices[1]); - return; - } - super.__delslice__(start,stop,step); - } - - public void __delitem__(PyObject key) { // ??? - PyType self_type=getType(); - PyObject impl=self_type.lookup("__delitem__"); - if (impl!=null) { - impl.__get__(this,self_type).__call__(key); - return; - } - super.__delitem__(key); - } - - public PyObject __call__(PyObject args[],String keywords[]) { - PyType self_type=getType(); - PyObject impl=self_type.lookup("__call__"); - if (impl!=null) { - return impl.__get__(this,self_type).__call__(args,keywords); - } - return super.__call__(args,keywords); - } - - public PyObject __findattr_ex__(String name) { - return Deriveds.__findattr_ex__(this,name); - } - - public void __setattr__(String name,PyObject value) { - PyType self_type=getType(); - PyObject impl=self_type.lookup("__setattr__"); - if (impl!=null) { - impl.__get__(this,self_type).__call__(PyString.fromInterned(name),value); - //CPython does not support instance-acquired finalizers. - //So we don't check for __del__ here. - return; - } - super.__setattr__(name,value); - } - - public void __delattr__(String name) { - PyType self_type=getType(); - PyObject impl=self_type.lookup("__delattr__"); - if (impl!=null) { - impl.__get__(this,self_type).__call__(PyString.fromInterned(name)); - return; - } - super.__delattr__(name); - } - - public PyObject __get__(PyObject obj,PyObject type) { - PyType self_type=getType(); - PyObject impl=self_type.lookup("__get__"); - if (impl!=null) { - if (obj==null) - obj=Py.None; - if (type==null) - type=Py.None; - return impl.__get__(this,self_type).__call__(obj,type); - } - return super.__get__(obj,type); - } - - public void __set__(PyObject obj,PyObject value) { - PyType self_type=getType(); - PyObject impl=self_type.lookup("__set__"); - if (impl!=null) { - impl.__get__(this,self_type).__call__(obj,value); - return; - } - super.__set__(obj,value); - } - - public void __delete__(PyObject obj) { - PyType self_type=getType(); - PyObject impl=self_type.lookup("__delete__"); - if (impl!=null) { - impl.__get__(this,self_type).__call__(obj); - return; - } - super.__delete__(obj); - } - - public PyObject __pow__(PyObject other,PyObject modulo) { - PyType self_type=getType(); - PyObject impl=self_type.lookup("__pow__"); - if (impl!=null) { - PyObject res; - if (modulo==null) { - res=impl.__get__(this,self_type).__call__(other); - } else { - res=impl.__get__(this,self_type).__call__(other,modulo); - } - if (res==Py.NotImplemented) - return null; - return res; - } - return super.__pow__(other,modulo); - } - - public void dispatch__init__(PyObject[]args,String[]keywords) { - Deriveds.dispatch__init__(this,args,keywords); - } - - public PyObject __index__() { - PyType self_type=getType(); - PyObject impl=self_type.lookup("__index__"); - if (impl!=null) { - PyObject res=impl.__get__(this,self_type).__call__(); - if (res instanceof PyInteger||res instanceof PyLong) { - return res; - } - throw Py.TypeError(String.format("__index__ returned non-(int,long) (type %s)",res.getType().fastGetName())); - } - return super.__index__(); - } - - public Object __tojava__(Class c) { - // If we are not being asked by the "default" conversion to java, then - // we can provide this as the result, as long as it is a instance of the - // specified class. Without this, derived.__tojava__(PyObject.class) - // would broke. (And that's not pure speculation: PyReflectedFunction's - // ReflectedArgs asks for things like that). - if ((c!=Object.class)&&(c!=Serializable.class)&&(c.isInstance(this))) { - return this; - } - // Otherwise, we call the derived __tojava__, if it exists: - PyType self_type=getType(); - PyObject impl=self_type.lookup("__tojava__"); - if (impl!=null) { - PyObject delegate=impl.__get__(this,self_type).__call__(Py.java2py(c)); - if (delegate!=this) - return delegate.__tojava__(Object.class); - } - return super.__tojava__(c); - } - - public Object __coerce_ex__(PyObject o) { - PyType self_type=getType(); - PyObject impl=self_type.lookup("__coerce__"); - if (impl!=null) { - PyObject res=impl.__get__(this,self_type).__call__(o); - if (res==Py.NotImplemented) - return Py.None; - if (!(res instanceof PyTuple)) - throw Py.TypeError("__coerce__ didn't return a 2-tuple"); - return((PyTuple)res).getArray(); - } - return super.__coerce_ex__(o); - } - -} +/* Generated file, do not modify. See jython/src/templates/gderived.py. */ +package org.python.core; + +import java.io.Serializable; +import org.python.core.finalization.FinalizeTrigger; +import org.python.core.finalization.FinalizablePyObjectDerived; + +public class PyShadowStringDerived extends PyShadowString implements Slotted,FinalizablePyObjectDerived,TraverseprocDerived { + + public PyObject getSlot(int index) { + return slots[index]; + } + + public void setSlot(int index,PyObject value) { + slots[index]=value; + } + + private PyObject[]slots; + + public void __del_derived__() { + PyType self_type=getType(); + PyObject impl=self_type.lookup("__del__"); + if (impl!=null) { + impl.__get__(this,self_type).__call__(); + } + } + + public void __ensure_finalizer__() { + FinalizeTrigger.ensureFinalizer(this); + } + + /* TraverseprocDerived implementation */ + public int traverseDerived(Visitproc visit,Object arg) { + int retVal; + for(int i=0;i0?1:0; + } + + public boolean __nonzero__() { + PyType self_type=getType(); + PyObject impl=self_type.lookup("__nonzero__"); + if (impl==null) { + impl=self_type.lookup("__len__"); + if (impl==null) + return super.__nonzero__(); + } + PyObject o=impl.__get__(this,self_type).__call__(); + Class c=o.getClass(); + if (c!=PyInteger.class&&c!=PyBoolean.class) { + throw Py.TypeError(String.format("__nonzero__ should return bool or int, returned %s",self_type.getName())); + } + return o.__nonzero__(); + } + + public boolean __contains__(PyObject o) { + PyType self_type=getType(); + PyObject impl=self_type.lookup("__contains__"); + if (impl==null) + return super.__contains__(o); + return impl.__get__(this,self_type).__call__(o).__nonzero__(); + } + + public int __len__() { + PyType self_type=getType(); + PyObject impl=self_type.lookup("__len__"); + if (impl!=null) { + PyObject res=impl.__get__(this,self_type).__call__(); + return res.asInt(); + } + return super.__len__(); + } + + public PyObject __iter__() { + PyType self_type=getType(); + PyObject impl=self_type.lookup("__iter__"); + if (impl!=null) + return impl.__get__(this,self_type).__call__(); + impl=self_type.lookup("__getitem__"); + if (impl==null) + return super.__iter__(); + return new PySequenceIter(this); + } + + public PyObject __iternext__() { + PyType self_type=getType(); + PyObject impl=self_type.lookup("next"); + if (impl!=null) { + try { + return impl.__get__(this,self_type).__call__(); + } catch (PyException exc) { + if (exc.match(Py.StopIteration)) + return null; + throw exc; + } + } + return super.__iternext__(); // ??? + } + + public PyObject __finditem__(PyObject key) { // ??? + PyType self_type=getType(); + PyObject impl=self_type.lookup("__getitem__"); + if (impl!=null) + try { + return impl.__get__(this,self_type).__call__(key); + } catch (PyException exc) { + if (exc.match(Py.LookupError)) + return null; + throw exc; + } + return super.__finditem__(key); + } + + public PyObject __finditem__(int key) { + PyType self_type=getType(); + PyObject impl=self_type.lookup("__getitem__"); + if (impl!=null) + try { + return impl.__get__(this,self_type).__call__(new PyInteger(key)); + } catch (PyException exc) { + if (exc.match(Py.LookupError)) + return null; + throw exc; + } + return super.__finditem__(key); + } + + public PyObject __getitem__(PyObject key) { + // Same as __finditem__, without swallowing LookupErrors. This allows + // __getitem__ implementations written in Python to raise custom + // exceptions (such as subclasses of KeyError). + // + // We are forced to duplicate the code, instead of defining __finditem__ + // in terms of __getitem__. That's because PyObject defines __getitem__ + // in terms of __finditem__. Therefore, we would end with an infinite + // loop when self_type.lookup("__getitem__") returns null: + // + // __getitem__ -> super.__getitem__ -> __finditem__ -> __getitem__ + // + // By duplicating the (short) lookup and call code, we are safe, because + // the call chains will be: + // + // __finditem__ -> super.__finditem__ + // + // __getitem__ -> super.__getitem__ -> __finditem__ -> super.__finditem__ + + PyType self_type=getType(); + PyObject impl=self_type.lookup("__getitem__"); + if (impl!=null) + return impl.__get__(this,self_type).__call__(key); + return super.__getitem__(key); + } + + public void __setitem__(PyObject key,PyObject value) { // ??? + PyType self_type=getType(); + PyObject impl=self_type.lookup("__setitem__"); + if (impl!=null) { + impl.__get__(this,self_type).__call__(key,value); + return; + } + super.__setitem__(key,value); + } + + public PyObject __getslice__(PyObject start,PyObject stop,PyObject step) { // ??? + if (step!=null) { + return __getitem__(new PySlice(start,stop,step)); + } + PyType self_type=getType(); + PyObject impl=self_type.lookup("__getslice__"); + if (impl!=null) { + PyObject[]indices=PySlice.indices2(this,start,stop); + return impl.__get__(this,self_type).__call__(indices[0],indices[1]); + } + return super.__getslice__(start,stop,step); + } + + public void __setslice__(PyObject start,PyObject stop,PyObject step,PyObject value) { + if (step!=null) { + __setitem__(new PySlice(start,stop,step),value); + return; + } + PyType self_type=getType(); + PyObject impl=self_type.lookup("__setslice__"); + if (impl!=null) { + PyObject[]indices=PySlice.indices2(this,start,stop); + impl.__get__(this,self_type).__call__(indices[0],indices[1],value); + return; + } + super.__setslice__(start,stop,step,value); + } + + public void __delslice__(PyObject start,PyObject stop,PyObject step) { + if (step!=null) { + __delitem__(new PySlice(start,stop,step)); + return; + } + PyType self_type=getType(); + PyObject impl=self_type.lookup("__delslice__"); + if (impl!=null) { + PyObject[]indices=PySlice.indices2(this,start,stop); + impl.__get__(this,self_type).__call__(indices[0],indices[1]); + return; + } + super.__delslice__(start,stop,step); + } + + public void __delitem__(PyObject key) { // ??? + PyType self_type=getType(); + PyObject impl=self_type.lookup("__delitem__"); + if (impl!=null) { + impl.__get__(this,self_type).__call__(key); + return; + } + super.__delitem__(key); + } + + public PyObject __call__(PyObject args[],String keywords[]) { + PyType self_type=getType(); + PyObject impl=self_type.lookup("__call__"); + if (impl!=null) { + return impl.__get__(this,self_type).__call__(args,keywords); + } + return super.__call__(args,keywords); + } + + public PyObject __findattr_ex__(String name) { + return Deriveds.__findattr_ex__(this,name); + } + + public void __setattr__(String name,PyObject value) { + PyType self_type=getType(); + PyObject impl=self_type.lookup("__setattr__"); + if (impl!=null) { + impl.__get__(this,self_type).__call__(PyString.fromInterned(name),value); + //CPython does not support instance-acquired finalizers. + //So we don't check for __del__ here. + return; + } + super.__setattr__(name,value); + } + + public void __delattr__(String name) { + PyType self_type=getType(); + PyObject impl=self_type.lookup("__delattr__"); + if (impl!=null) { + impl.__get__(this,self_type).__call__(PyString.fromInterned(name)); + return; + } + super.__delattr__(name); + } + + public PyObject __get__(PyObject obj,PyObject type) { + PyType self_type=getType(); + PyObject impl=self_type.lookup("__get__"); + if (impl!=null) { + if (obj==null) + obj=Py.None; + if (type==null) + type=Py.None; + return impl.__get__(this,self_type).__call__(obj,type); + } + return super.__get__(obj,type); + } + + public void __set__(PyObject obj,PyObject value) { + PyType self_type=getType(); + PyObject impl=self_type.lookup("__set__"); + if (impl!=null) { + impl.__get__(this,self_type).__call__(obj,value); + return; + } + super.__set__(obj,value); + } + + public void __delete__(PyObject obj) { + PyType self_type=getType(); + PyObject impl=self_type.lookup("__delete__"); + if (impl!=null) { + impl.__get__(this,self_type).__call__(obj); + return; + } + super.__delete__(obj); + } + + public PyObject __pow__(PyObject other,PyObject modulo) { + PyType self_type=getType(); + PyObject impl=self_type.lookup("__pow__"); + if (impl!=null) { + PyObject res; + if (modulo==null) { + res=impl.__get__(this,self_type).__call__(other); + } else { + res=impl.__get__(this,self_type).__call__(other,modulo); + } + if (res==Py.NotImplemented) + return null; + return res; + } + return super.__pow__(other,modulo); + } + + public void dispatch__init__(PyObject[]args,String[]keywords) { + Deriveds.dispatch__init__(this,args,keywords); + } + + public PyObject __index__() { + PyType self_type=getType(); + PyObject impl=self_type.lookup("__index__"); + if (impl!=null) { + PyObject res=impl.__get__(this,self_type).__call__(); + if (res instanceof PyInteger||res instanceof PyLong) { + return res; + } + throw Py.TypeError(String.format("__index__ returned non-(int,long) (type %s)",res.getType().fastGetName())); + } + return super.__index__(); + } + + public Object __tojava__(Class c) { + // If we are not being asked by the "default" conversion to java, then + // we can provide this as the result, as long as it is a instance of the + // specified class. Without this, derived.__tojava__(PyObject.class) + // would broke. (And that's not pure speculation: PyReflectedFunction's + // ReflectedArgs asks for things like that). + if ((c!=Object.class)&&(c!=Serializable.class)&&(c.isInstance(this))) { + return this; + } + // Otherwise, we call the derived __tojava__, if it exists: + PyType self_type=getType(); + PyObject impl=self_type.lookup("__tojava__"); + if (impl!=null) { + PyObject delegate=impl.__get__(this,self_type).__call__(Py.java2py(c)); + if (delegate!=this) + return delegate.__tojava__(Object.class); + } + return super.__tojava__(c); + } + + public Object __coerce_ex__(PyObject o) { + PyType self_type=getType(); + PyObject impl=self_type.lookup("__coerce__"); + if (impl!=null) { + PyObject res=impl.__get__(this,self_type).__call__(o); + if (res==Py.NotImplemented) + return Py.None; + if (!(res instanceof PyTuple)) + throw Py.TypeError("__coerce__ didn't return a 2-tuple"); + return((PyTuple)res).getArray(); + } + return super.__coerce_ex__(o); + } + +} diff --git a/src/templates/shadowstr.derived b/src/templates/shadowstr.derived new file mode 100644 --- /dev/null +++ b/src/templates/shadowstr.derived @@ -0,0 +1,5 @@ +base_class: PyShadowString +want_dict: true +ctr: PyObject str, PyObject shadow +incl: object +no_toString: true -- Repository URL: https://hg.python.org/jython From jython-checkins at python.org Wed Jan 3 17:39:16 2018 From: jython-checkins at python.org (jeff.allen) Date: Wed, 03 Jan 2018 22:39:16 +0000 Subject: [Jython-checkins] =?utf-8?q?jython=3A_PyException=2EgetMessage?= =?utf-8?q?=28=29_returns_similar_message_to_Python_=28fixes_=232650=29?= Message-ID: <20180103223916.1.01FDAAB92D505914@mg.python.org> https://hg.python.org/jython/rev/d74f8c2cd56f changeset: 8150:d74f8c2cd56f user: James Mudd date: Wed Jan 03 20:03:14 2018 +0000 summary: PyException.getMessage() returns similar message to Python (fixes #2650) This allows a PyException raised by Python code in an embedded Jython interpreter to create a meaningful log entry under Java logging frameworks. files: NEWS | 1 + src/org/python/core/PyException.java | 6 ++++++ 2 files changed, 7 insertions(+), 0 deletions(-) diff --git a/NEWS b/NEWS --- a/NEWS +++ b/NEWS @@ -3,6 +3,7 @@ For more details, please see https://hg.python.org/jython Developement tip + - [ 2650 ] Detail message is not set on PyException from PythonInterpreter - [ 2403 ] VerifyError when implementing interfaces containing default methods (Java 8) Jython 2.7.2a1 diff --git a/src/org/python/core/PyException.java b/src/org/python/core/PyException.java --- a/src/org/python/core/PyException.java +++ b/src/org/python/core/PyException.java @@ -73,6 +73,12 @@ } @Override + public String getMessage() { + normalize(); + return Py.formatException(type, value); + } + + @Override public synchronized void printStackTrace(PrintStream s) { if (printingStackTrace) { super.printStackTrace(s); -- Repository URL: https://hg.python.org/jython