@@ -414,9 +414,11 @@ anextawaitable_proxy(anextawaitableobject *obj, char *meth, PyObject *arg)
414414    if  (awaitable  ==  NULL ) {
415415        return  NULL ;
416416    }
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 );
420422    Py_DECREF (awaitable );
421423    if  (ret  !=  NULL ) {
422424        return  ret ;
@@ -451,10 +453,10 @@ anextawaitable_throw(PyObject *op, PyObject *args)
451453
452454
453455static  PyObject  * 
454- anextawaitable_close (PyObject  * op , PyObject  * args )
456+ anextawaitable_close (PyObject  * op , PyObject  * Py_UNUSED ( dummy ) )
455457{
456458    anextawaitableobject  * obj  =  anextawaitableobject_CAST (op );
457-     return  anextawaitable_proxy (obj , "close" , args );
459+     return  anextawaitable_proxy (obj , "close" , NULL );
458460}
459461
460462
@@ -480,7 +482,7 @@ PyDoc_STRVAR(close_doc,
480482static  PyMethodDef  anextawaitable_methods [] =  {
481483    {"send" , anextawaitable_send , METH_O , send_doc },
482484    {"throw" , anextawaitable_throw , METH_VARARGS , throw_doc },
483-     {"close" , anextawaitable_close , METH_VARARGS , close_doc },
485+     {"close" , anextawaitable_close , METH_NOARGS , close_doc },
484486    {NULL , NULL }        /* Sentinel */ 
485487};
486488
0 commit comments