Issue2090

classification
Title: python type 'long' doesn't work well under JSR 223
Type: behaviour Severity: normal
Components: Core Versions: Jython 2.7
process
Status: open Resolution: fixed
Dependencies: Superseder:
Assigned To: jeff.allen Nosy List: jeff.allen, rjolly, zyasoft
Priority: high Keywords: patch

Created on 2013-09-23.09:12:49 by rjolly, last changed 2014-10-14.22:06:58 by jeff.allen.

Messages
msg8123 (view) Author: Raphael Jolly (rjolly) Date: 2013-09-23.09:12:49
The bug in http://bugs.jython.org/issue1494 with jrunscript is not solved. It should be reopened.
msg8124 (view) Author: Raphael Jolly (rjolly) Date: 2013-09-23.15:31:28
I think org.python.core.PyLong.__tojava__(Object.class) should return a Long when Long.MIN_VALUE <= value <= Long.MAX_VALUE
msg8125 (view) Author: Raphael Jolly (rjolly) Date: 2013-09-24.13:10:13
BigInteger was not transformed back right. Fixed in https://bitbucket.org/jython/jython/pull-request/9/1494-fix-behavior-of-long-under-jsr-223
msg9131 (view) Author: Jim Baker (zyasoft) Date: 2014-10-10.04:05:50
Time to revisit, especially in light of recent jython-users discussion and the fact the test was added.
msg9142 (view) Author: Jeff Allen (jeff.allen) Date: 2014-10-14.08:49:16
Ok, I see what's going on here and why it only emerges when using the script engine. I'll merge this in. Also answers this recent discussion, I believe:
http://permalink.gmane.org/gmane.comp.lang.jython.user/10467
msg9152 (view) Author: Jeff Allen (jeff.allen) Date: 2014-10-14.22:06:58
We now have, using Raphael's patch and an embedded JSR-233 script engine:
TEST >>> from java.math import BigInteger
TEST >>> a = BigInteger('10')
TEST >>> type(a)
class org.python.core.PyLong
TEST >>> a > 100
false
TEST >>> a > 1
true

This is a test program very close to that offered in http://permalink.gmane.org/gmane.comp.lang.jython.user/10467. The console interpreter does not behave consistently with this, so there's something to resolve, perhaps under #2216.

I was unable to pull the change request into my repository, but there's not much code, so I pasted it. Now at:
https://hg.python.org/jython/rev/4ed64dc6c895
History
Date User Action Args
2014-10-14 22:06:58jeff.allensetresolution: fixed
messages: + msg9152
2014-10-14 08:49:16jeff.allensetassignee: jeff.allen
messages: + msg9142
nosy: + jeff.allen
versions: + Jython 2.7, - Jython 2.5
2014-10-10 04:13:11zyasoftsetpriority: high
2014-10-10 04:05:50zyasoftsetnosy: + zyasoft
messages: + msg9131
2013-12-06 08:46:05jeff.allensetkeywords: + patch
2013-09-24 13:10:13rjollysetmessages: + msg8125
2013-09-23 15:31:28rjollysetmessages: + msg8124
2013-09-23 09:12:49rjollycreate