From 7e60192fe0dfd763b0d458cf0898ba4f7ac7d81a Mon Sep 17 00:00:00 2001 From: Serhiy Storchaka Date: Mon, 10 Jul 2017 11:25:34 +0300 Subject: [PATCH] Remove _PyArg_NoStackKeywords(). (#2641) --- Include/modsupport.h | 3 --- Modules/_hashopenssl.c | 8 ++------ Python/getargs.c | 18 ------------------ 3 files changed, 2 insertions(+), 27 deletions(-) diff --git a/Include/modsupport.h b/Include/modsupport.h index 853860f4d2..8c7cf39d9a 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 7ae7ea5be5..037fa4e2e9 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 f555870f7e..c61d945189 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) { -- 2.40.0