File tree Expand file tree Collapse file tree 2 files changed +8
-5
lines changed
graalpython/com.oracle.graal.python.cext/src Expand file tree Collapse file tree 2 files changed +8
-5
lines changed Original file line number Diff line number Diff line change @@ -105,10 +105,12 @@ static void initialize_capi() {
105
105
}
106
106
107
107
void * native_to_java (PyObject * obj ) {
108
- if (obj == Py_None ) {
108
+ if (obj == Py_None ) {
109
109
return Py_None ;
110
110
} else if (obj == NULL ) {
111
111
return Py_NoValue ;
112
+ } else if (polyglot_is_string (obj )) {
113
+ return obj ;
112
114
} else if (truffle_is_handle_to_managed (obj )) {
113
115
return truffle_managed_from_handle (obj );
114
116
} else if (truffle_is_handle_to_managed (obj -> ob_refcnt )) {
Original file line number Diff line number Diff line change @@ -251,6 +251,7 @@ PyObject* _Py_BuildValue_SizeT(const char *format, ...) {
251
251
# define APPEND_VALUE (list , value ) PyList_Append(list, value); value_idx++
252
252
253
253
PyObject * (* converter )(void * ) = NULL ;
254
+ char argchar [2 ] = {'\0' };
254
255
unsigned int value_idx = 1 ;
255
256
unsigned int format_idx = 0 ;
256
257
build_stack * v = (build_stack * )calloc (1 , sizeof (build_stack ));
@@ -329,12 +330,12 @@ PyObject* _Py_BuildValue_SizeT(const char *format, ...) {
329
330
APPEND_VALUE (list , (Py_ssize_t )ARG );
330
331
break ;
331
332
case 'c' :
332
- c = (char )ARG ;
333
- APPEND_VALUE (list , PyBytes_FromStringAndSize (& c , 1 ));
333
+ argchar [ 0 ] = (char )ARG ;
334
+ APPEND_VALUE (list , PyBytes_FromStringAndSize (argchar , 1 ));
334
335
break ;
335
336
case 'C' :
336
- c = (char )ARG ;
337
- APPEND_VALUE (list , polyglot_from_string_n ( & c , 1 , "utf-8 " ));
337
+ argchar [ 0 ] = (char )ARG ;
338
+ APPEND_VALUE (list , polyglot_from_string ( argchar , "ascii " ));
338
339
break ;
339
340
case 'd' :
340
341
case 'f' :
You can’t perform that action at this time.
0 commit comments