mirror of
https://github.com/python/cpython.git
synced 2025-08-04 17:08:35 +00:00
gh-131666: mark anext_awaitable.close
as a METH_NOARGS
instead of METH_VARARGS
(#131671)
This commit is contained in:
parent
c3b8d73208
commit
1393bd3548
3 changed files with 20 additions and 6 deletions
|
@ -414,9 +414,11 @@ anextawaitable_proxy(anextawaitableobject *obj, char *meth, PyObject *arg)
|
|||
if (awaitable == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
// 'arg' may be a tuple (if coming from a METH_VARARGS method)
|
||||
// or a single object (if coming from a METH_O method).
|
||||
PyObject *ret = PyObject_CallMethod(awaitable, meth, "O", arg);
|
||||
// When specified, 'arg' may be a tuple (if coming from a METH_VARARGS
|
||||
// method) or a single object (if coming from a METH_O method).
|
||||
PyObject *ret = arg == NULL
|
||||
? PyObject_CallMethod(awaitable, meth, NULL)
|
||||
: PyObject_CallMethod(awaitable, meth, "O", arg);
|
||||
Py_DECREF(awaitable);
|
||||
if (ret != NULL) {
|
||||
return ret;
|
||||
|
@ -451,10 +453,10 @@ anextawaitable_throw(PyObject *op, PyObject *args)
|
|||
|
||||
|
||||
static PyObject *
|
||||
anextawaitable_close(PyObject *op, PyObject *args)
|
||||
anextawaitable_close(PyObject *op, PyObject *Py_UNUSED(dummy))
|
||||
{
|
||||
anextawaitableobject *obj = anextawaitableobject_CAST(op);
|
||||
return anextawaitable_proxy(obj, "close", args);
|
||||
return anextawaitable_proxy(obj, "close", NULL);
|
||||
}
|
||||
|
||||
|
||||
|
@ -480,7 +482,7 @@ PyDoc_STRVAR(close_doc,
|
|||
static PyMethodDef anextawaitable_methods[] = {
|
||||
{"send", anextawaitable_send, METH_O, send_doc},
|
||||
{"throw", anextawaitable_throw, METH_VARARGS, throw_doc},
|
||||
{"close", anextawaitable_close, METH_VARARGS, close_doc},
|
||||
{"close", anextawaitable_close, METH_NOARGS, close_doc},
|
||||
{NULL, NULL} /* Sentinel */
|
||||
};
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue