diff --git a/Include/modsupport.h b/Include/modsupport.h index 853860f4d27..8c7cf39d9a3 100644 --- a/Include/modsupport.h +++ b/Include/modsupport.h @@ -60,12 +60,9 @@ PyAPI_FUNC(int) _PyArg_UnpackStack( ...); PyAPI_FUNC(int) _PyArg_NoKeywords(const char *funcname, PyObject *kwargs); -PyAPI_FUNC(int) _PyArg_NoStackKeywords(const char *funcname, PyObject *kwnames); PyAPI_FUNC(int) _PyArg_NoPositional(const char *funcname, PyObject *args); #define _PyArg_NoKeywords(funcname, kwargs) \ ((kwargs) == NULL || _PyArg_NoKeywords((funcname), (kwargs))) -#define _PyArg_NoStackKeywords(funcname, kwnames) \ - ((kwnames) == NULL || _PyArg_NoStackKeywords((funcname), (kwnames))) #define _PyArg_NoPositional(funcname, args) \ ((args) == NULL || _PyArg_NoPositional((funcname), (args))) diff --git a/Modules/_hashopenssl.c b/Modules/_hashopenssl.c index 7ae7ea5be54..037fa4e2e99 100644 --- a/Modules/_hashopenssl.c +++ b/Modules/_hashopenssl.c @@ -925,15 +925,11 @@ generate_hash_name_list(void) */ #define GEN_CONSTRUCTOR(NAME) \ static PyObject * \ - EVP_new_ ## NAME (PyObject *self, PyObject **args, Py_ssize_t nargs, PyObject *kwnames) \ + EVP_new_ ## NAME (PyObject *self, PyObject **args, Py_ssize_t nargs) \ { \ PyObject *data_obj = NULL; \ Py_buffer view = { 0 }; \ PyObject *ret_obj; \ - \ - if (!_PyArg_NoStackKeywords(#NAME, kwnames)) { \ - return NULL; \ - } \ \ if (!_PyArg_ParseStack(args, nargs, "|O:" #NAME , &data_obj)) { \ return NULL; \ @@ -967,7 +963,7 @@ generate_hash_name_list(void) /* a PyMethodDef structure for the constructor */ #define CONSTRUCTOR_METH_DEF(NAME) \ - {"openssl_" #NAME, (PyCFunction)EVP_new_ ## NAME, METH_FASTCALL | METH_KEYWORDS, \ + {"openssl_" #NAME, (PyCFunction)EVP_new_ ## NAME, METH_FASTCALL, \ PyDoc_STR("Returns a " #NAME \ " hash object; optionally initialized with a string") \ } diff --git a/Python/getargs.c b/Python/getargs.c index f555870f7e0..c61d9451896 100644 --- a/Python/getargs.c +++ b/Python/getargs.c @@ -2483,7 +2483,6 @@ _PyArg_UnpackStack(PyObject **args, Py_ssize_t nargs, const char *name, #undef _PyArg_NoKeywords -#undef _PyArg_NoStackKeywords #undef _PyArg_NoPositional /* For type constructors that don't take keyword args @@ -2511,23 +2510,6 @@ _PyArg_NoKeywords(const char *funcname, PyObject *kwargs) } -int -_PyArg_NoStackKeywords(const char *funcname, PyObject *kwnames) -{ - if (kwnames == NULL) { - return 1; - } - assert(PyTuple_CheckExact(kwnames)); - if (PyTuple_GET_SIZE(kwnames) == 0) { - return 1; - } - - PyErr_Format(PyExc_TypeError, "%.200s() takes no keyword arguments", - funcname); - return 0; -} - - int _PyArg_NoPositional(const char *funcname, PyObject *args) {