Remove _PyArg_NoStackKeywords(). (#2641)
This commit is contained in:
parent
bb2bae84d6
commit
7e60192fe0
|
@ -60,12 +60,9 @@ PyAPI_FUNC(int) _PyArg_UnpackStack(
|
||||||
...);
|
...);
|
||||||
|
|
||||||
PyAPI_FUNC(int) _PyArg_NoKeywords(const char *funcname, PyObject *kwargs);
|
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);
|
PyAPI_FUNC(int) _PyArg_NoPositional(const char *funcname, PyObject *args);
|
||||||
#define _PyArg_NoKeywords(funcname, kwargs) \
|
#define _PyArg_NoKeywords(funcname, kwargs) \
|
||||||
((kwargs) == NULL || _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) \
|
#define _PyArg_NoPositional(funcname, args) \
|
||||||
((args) == NULL || _PyArg_NoPositional((funcname), (args)))
|
((args) == NULL || _PyArg_NoPositional((funcname), (args)))
|
||||||
|
|
||||||
|
|
|
@ -925,15 +925,11 @@ generate_hash_name_list(void)
|
||||||
*/
|
*/
|
||||||
#define GEN_CONSTRUCTOR(NAME) \
|
#define GEN_CONSTRUCTOR(NAME) \
|
||||||
static PyObject * \
|
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; \
|
PyObject *data_obj = NULL; \
|
||||||
Py_buffer view = { 0 }; \
|
Py_buffer view = { 0 }; \
|
||||||
PyObject *ret_obj; \
|
PyObject *ret_obj; \
|
||||||
\
|
|
||||||
if (!_PyArg_NoStackKeywords(#NAME, kwnames)) { \
|
|
||||||
return NULL; \
|
|
||||||
} \
|
|
||||||
\
|
\
|
||||||
if (!_PyArg_ParseStack(args, nargs, "|O:" #NAME , &data_obj)) { \
|
if (!_PyArg_ParseStack(args, nargs, "|O:" #NAME , &data_obj)) { \
|
||||||
return NULL; \
|
return NULL; \
|
||||||
|
@ -967,7 +963,7 @@ generate_hash_name_list(void)
|
||||||
|
|
||||||
/* a PyMethodDef structure for the constructor */
|
/* a PyMethodDef structure for the constructor */
|
||||||
#define CONSTRUCTOR_METH_DEF(NAME) \
|
#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 \
|
PyDoc_STR("Returns a " #NAME \
|
||||||
" hash object; optionally initialized with a string") \
|
" hash object; optionally initialized with a string") \
|
||||||
}
|
}
|
||||||
|
|
|
@ -2483,7 +2483,6 @@ _PyArg_UnpackStack(PyObject **args, Py_ssize_t nargs, const char *name,
|
||||||
|
|
||||||
|
|
||||||
#undef _PyArg_NoKeywords
|
#undef _PyArg_NoKeywords
|
||||||
#undef _PyArg_NoStackKeywords
|
|
||||||
#undef _PyArg_NoPositional
|
#undef _PyArg_NoPositional
|
||||||
|
|
||||||
/* For type constructors that don't take keyword args
|
/* 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
|
int
|
||||||
_PyArg_NoPositional(const char *funcname, PyObject *args)
|
_PyArg_NoPositional(const char *funcname, PyObject *args)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue