@@ -227,6 +227,11 @@ PyObject* PyObject_CallObject(PyObject* callable, PyObject* args) {
227
227
228
228
PyObject * PyObject_CallFunction (PyObject * callable , const char * fmt , ...) {
229
229
PyObject * args ;
230
+
231
+ if (fmt == NULL || fmt [0 ] == '\0' ) {
232
+ return _PyObject_CallNoArg (callable );
233
+ }
234
+
230
235
CALL_WITH_VARARGS (args , Py_BuildValue , 2 , fmt );
231
236
if (strlen (fmt ) < 2 ) {
232
237
PyObject * singleArg = args ;
@@ -240,6 +245,11 @@ PyObject* PyObject_CallFunction(PyObject* callable, const char* fmt, ...) {
240
245
241
246
PyObject * _PyObject_CallFunction_SizeT (PyObject * callable , const char * fmt , ...) {
242
247
PyObject * args ;
248
+
249
+ if (fmt == NULL || fmt [0 ] == '\0' ) {
250
+ return _PyObject_CallNoArg (callable );
251
+ }
252
+
243
253
CALL_WITH_VARARGS (args , Py_BuildValue , 2 , fmt );
244
254
if (strlen (fmt ) < 2 ) {
245
255
PyObject * singleArg = args ;
@@ -263,13 +273,21 @@ PyObject* PyObject_CallFunctionObjArgs(PyObject *callable, ...) {
263
273
UPCALL_ID (PyObject_CallMethod );
264
274
PyObject * PyObject_CallMethod (PyObject * object , const char * method , const char * fmt , ...) {
265
275
PyObject * args ;
266
- CALL_WITH_VARARGS (args , Py_BuildValue , 3 , fmt );
276
+ if (fmt == NULL || fmt [0 ] == '\0' ) {
277
+ args = Py_None ;
278
+ } else {
279
+ CALL_WITH_VARARGS (args , Py_BuildValue , 3 , fmt );
280
+ }
267
281
return UPCALL_CEXT_O (_jls_PyObject_CallMethod , native_to_java (object ), polyglot_from_string (method , SRC_CS ), native_to_java (args ));
268
282
}
269
283
270
284
PyObject * _PyObject_CallMethod_SizeT (PyObject * object , const char * method , const char * fmt , ...) {
271
285
PyObject * args ;
272
- CALL_WITH_VARARGS (args , Py_BuildValue , 3 , fmt );
286
+ if (fmt == NULL || fmt [0 ] == '\0' ) {
287
+ args = Py_None ;
288
+ } else {
289
+ CALL_WITH_VARARGS (args , Py_BuildValue , 3 , fmt );
290
+ }
273
291
return UPCALL_CEXT_O (_jls_PyObject_CallMethod , native_to_java (object ), polyglot_from_string (method , SRC_CS ), native_to_java (args ));
274
292
}
275
293
0 commit comments