-
Notifications
You must be signed in to change notification settings - Fork 80
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
A workaround to a JPY issue with long values, fixes #1461 #1843
Conversation
In JPY, PyObject.getObjectValue() seems always to select Java Integer for a Python int object (3.00+) which is not restricted by the number of bits
DHE suffers from the same problem, added @cpwright as a reviewer to loop him in. |
engine/table/src/main/java/io/deephaven/engine/util/PythonScopeJpyImpl.java
Outdated
Show resolved
Hide resolved
engine/table/src/main/java/io/deephaven/engine/util/PythonScopeJpyImpl.java
Outdated
Show resolved
Hide resolved
Should we simply look further up the chain at JPy and fix that. I expect the problem relates to these lines in
|
I made this same comment here #1461 (comment). Ultimately, I think the implicit type conversion layer of python objects to to java objects needs to be examined, and we may want to provide the (java) caller with better hooks on how to handle the different cases. These types of problems may also be better solved by pushing application logic further down into python instead of trying to be as general as we can w/ |
I think you meant JType_ConvertPythonToJavaObject (not JType_ConvertJavaToPythonObject). The straightforward changes I could see are:
I am not strongly inclined towards any one of the 3 solutions, but this PR is still my favorite simply because it is higher level and less likely to break other things (?) |
engine/table/src/main/java/io/deephaven/engine/util/PythonScopeJpyImpl.java
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm OK with this approach. Based on @rcaudy feedback thought, he may prefer the pyObject.isLong()
, pyObject.getLongValue()
, and seeing if it fits into int. It's an extra case, but it fits the pattern established here.
In JPY, PyObject.getObjectValue() seems always to select Java Integer
for a Python int object which is not restricted by the number
of bits in Python 3