@@ -199,51 +199,38 @@ PyObject * PyVectorcall_Call(PyObject *callable, PyObject *tuple, PyObject *kwar
199199 return _Py_CheckFunctionResult (callable , result , NULL );
200200}
201201
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 );
203205UPCALL_TYPED_ID (PyObject_Call , call_fun_t );
204206PyObject * 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 );
206208}
207209
208210PyObject * 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 );
210212}
211213
212214PyObject * PyObject_CallFunction (PyObject * callable , const char * fmt , ...) {
213215 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 );
215217 }
216218 va_list va ;
217219 va_start (va , fmt );
218220 PyObject * args = Py_VaBuildValue (fmt , va );
219221 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 ));
228223}
229224
230225PyObject * _PyObject_CallFunction_SizeT (PyObject * callable , const char * fmt , ...) {
231226 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 );
233228 }
234-
235229 va_list va ;
236230 va_start (va , fmt );
237231 PyObject * args = Py_VaBuildValue (fmt , va );
238232 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 ));
247234}
248235
249236typedef PyObject * (* call_fun_obj_args_t )(PyObject * , void * );
0 commit comments