@@ -414,9 +414,11 @@ anextawaitable_proxy(anextawaitableobject *obj, char *meth, PyObject *arg)
414
414
if (awaitable == NULL ) {
415
415
return NULL ;
416
416
}
417
- // 'arg' may be a tuple (if coming from a METH_VARARGS method)
418
- // or a single object (if coming from a METH_O method).
419
- PyObject * ret = PyObject_CallMethod (awaitable , meth , "O" , arg );
417
+ // When specified, 'arg' may be a tuple (if coming from a METH_VARARGS
418
+ // method) or a single object (if coming from a METH_O method).
419
+ PyObject * ret = arg == NULL
420
+ ? PyObject_CallMethod (awaitable , meth , NULL )
421
+ : PyObject_CallMethod (awaitable , meth , "O" , arg );
420
422
Py_DECREF (awaitable );
421
423
if (ret != NULL ) {
422
424
return ret ;
@@ -451,10 +453,10 @@ anextawaitable_throw(PyObject *op, PyObject *args)
451
453
452
454
453
455
static PyObject *
454
- anextawaitable_close (PyObject * op , PyObject * args )
456
+ anextawaitable_close (PyObject * op , PyObject * Py_UNUSED ( dummy ) )
455
457
{
456
458
anextawaitableobject * obj = anextawaitableobject_CAST (op );
457
- return anextawaitable_proxy (obj , "close" , args );
459
+ return anextawaitable_proxy (obj , "close" , NULL );
458
460
}
459
461
460
462
@@ -480,7 +482,7 @@ PyDoc_STRVAR(close_doc,
480
482
static PyMethodDef anextawaitable_methods [] = {
481
483
{"send" , anextawaitable_send , METH_O , send_doc },
482
484
{"throw" , anextawaitable_throw , METH_VARARGS , throw_doc },
483
- {"close" , anextawaitable_close , METH_VARARGS , close_doc },
485
+ {"close" , anextawaitable_close , METH_NOARGS , close_doc },
484
486
{NULL , NULL } /* Sentinel */
485
487
};
486
488
0 commit comments