@@ -199,51 +199,38 @@ PyObject * PyVectorcall_Call(PyObject *callable, PyObject *tuple, PyObject *kwar
199
199
return _Py_CheckFunctionResult (callable , result , NULL );
200
200
}
201
201
202
- typedef PyObject * (* call_fun_t )(PyObject * , PyObject * , PyObject * );
202
+ #define IS_SINGLE_ARG (_fmt ) ((_fmt[0]) != '\0' && (_fmt[1]) == '\0')
203
+
204
+ typedef PyObject * (* call_fun_t )(PyObject * , PyObject * , PyObject * , int32_t );
203
205
UPCALL_TYPED_ID (PyObject_Call , call_fun_t );
204
206
PyObject * PyObject_Call (PyObject * callable , PyObject * args , PyObject * kwargs ) {
205
- return _jls_PyObject_Call (native_to_java (callable ), native_to_java (args ), native_to_java (kwargs ));
207
+ return _jls_PyObject_Call (native_to_java (callable ), native_to_java (args ), native_to_java (kwargs ), 0 );
206
208
}
207
209
208
210
PyObject * PyObject_CallObject (PyObject * callable , PyObject * args ) {
209
- return _jls_PyObject_Call (native_to_java (callable ), native_to_java (args ), NULL );
211
+ return _jls_PyObject_Call (native_to_java (callable ), native_to_java (args ), NULL , 0 );
210
212
}
211
213
212
214
PyObject * PyObject_CallFunction (PyObject * callable , const char * fmt , ...) {
213
215
if (fmt == NULL || fmt [0 ] == '\0' ) {
214
- return _jls_PyObject_Call (native_to_java (callable ), NULL , NULL );
216
+ return _jls_PyObject_Call (native_to_java (callable ), NULL , NULL , 0 );
215
217
}
216
218
va_list va ;
217
219
va_start (va , fmt );
218
220
PyObject * args = Py_VaBuildValue (fmt , va );
219
221
va_end (va );
220
-
221
- if (strlen (fmt ) == 1 ) {
222
- PyObject * singleArg = args ;
223
- args = PyTuple_New (1 );
224
- Py_XINCREF (singleArg );
225
- PyTuple_SetItem (args , 0 , singleArg );
226
- }
227
- return _jls_PyObject_Call (native_to_java (callable ), native_to_java (args ), NULL );
222
+ return _jls_PyObject_Call (native_to_java (callable ), native_to_java (args ), NULL , IS_SINGLE_ARG (fmt ));
228
223
}
229
224
230
225
PyObject * _PyObject_CallFunction_SizeT (PyObject * callable , const char * fmt , ...) {
231
226
if (fmt == NULL || fmt [0 ] == '\0' ) {
232
- return _jls_PyObject_Call (native_to_java (callable ), NULL , NULL );
227
+ return _jls_PyObject_Call (native_to_java (callable ), NULL , NULL , 0 );
233
228
}
234
-
235
229
va_list va ;
236
230
va_start (va , fmt );
237
231
PyObject * args = Py_VaBuildValue (fmt , va );
238
232
va_end (va );
239
-
240
- if (strlen (fmt ) == 1 ) {
241
- PyObject * singleArg = args ;
242
- args = PyTuple_New (1 );
243
- Py_XINCREF (singleArg );
244
- PyTuple_SetItem (args , 0 , singleArg );
245
- }
246
- return _jls_PyObject_Call (native_to_java (callable ), native_to_java (args ), NULL );
233
+ return _jls_PyObject_Call (native_to_java (callable ), native_to_java (args ), NULL , IS_SINGLE_ARG (fmt ));
247
234
}
248
235
249
236
typedef PyObject * (* call_fun_obj_args_t )(PyObject * , void * );
0 commit comments