Skip to content

Commit cc07558

Browse files
committed
Fix: add missing case for double in ToJavaNode.
1 parent 68e9ff8 commit cc07558

File tree

2 files changed

+8
-5
lines changed

2 files changed

+8
-5
lines changed

graalpython/com.oracle.graal.python/src/com/oracle/graal/python/builtins/objects/cext/CExtNodes.java

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1274,9 +1274,14 @@ static byte doByte(@SuppressWarnings("unused") CExtContext nativeContext, byte b
12741274
return b;
12751275
}
12761276

1277+
@Specialization
1278+
static double doDouble(@SuppressWarnings("unused") CExtContext nativeContext, double d) {
1279+
return d;
1280+
}
1281+
12771282
protected static boolean isForeignObject(Object obj) {
12781283
return !(obj instanceof PythonAbstractObject || obj instanceof PythonNativeWrapper || obj instanceof String || obj instanceof Boolean || obj instanceof Integer ||
1279-
obj instanceof Long || obj instanceof Byte);
1284+
obj instanceof Long || obj instanceof Byte || obj instanceof Double);
12801285
}
12811286
}
12821287

graalpython/lib-graalpython/python_cext.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@
4141
import sys
4242
import _thread
4343

44-
capi = capi_to_java = None
44+
capi = None
4545
_capi_hooks = []
4646

4747
__builtins_module_dict = None
@@ -991,7 +991,7 @@ def member_getter(self):
991991
# NOTE: The 'to_java' is intended and correct because this call will do a downcall an
992992
# all args will go through 'to_sulong' then. So, if we don't convert the pointer
993993
# 'closure' to a Python value, we will get the wrong wrapper from 'to_sulong'.
994-
return capi_to_java(getter_w(self, closure_converted))
994+
return to_java(getter_w(self, closure_converted))
995995

996996
fget = member_getter
997997
if setter:
@@ -1379,9 +1379,7 @@ def import_c_func(name):
13791379
def initialize_capi(capi_library):
13801380
"""This method is called from a C API constructor function"""
13811381
global capi
1382-
global capi_to_java
13831382
capi = capi_library
1384-
capi_to_java = import_c_func("to_java")
13851383

13861384
initialize_member_accessors()
13871385
initialize_datetime_capi()

0 commit comments

Comments
 (0)