mirror of
https://github.com/python/cpython.git
synced 2026-01-06 15:32:22 +00:00
Revert "gh-112068: C API: Add support of nullable arguments in PyArg_Parse (GH-121303)" (#136991)
This commit is contained in:
parent
b31e5d6de1
commit
3a89dfe32b
12 changed files with 144 additions and 322 deletions
|
|
@ -3937,7 +3937,9 @@ _validate_paramflags(ctypes_state *st, PyTypeObject *type, PyObject *paramflags)
|
|||
PyObject *name = Py_None;
|
||||
PyObject *defval;
|
||||
PyObject *typ;
|
||||
if (!PyArg_ParseTuple(item, "i|U?O", &flag, &name, &defval)) {
|
||||
if (!PyArg_ParseTuple(item, "i|OO", &flag, &name, &defval) ||
|
||||
!(name == Py_None || PyUnicode_Check(name)))
|
||||
{
|
||||
PyErr_SetString(PyExc_TypeError,
|
||||
"paramflags must be a sequence of (int [,string [,value]]) tuples");
|
||||
return 0;
|
||||
|
|
@ -4002,8 +4004,10 @@ PyCFuncPtr_FromDll(PyTypeObject *type, PyObject *args, PyObject *kwds)
|
|||
void *handle;
|
||||
PyObject *paramflags = NULL;
|
||||
|
||||
if (!PyArg_ParseTuple(args, "O|O?", &ftuple, ¶mflags))
|
||||
if (!PyArg_ParseTuple(args, "O|O", &ftuple, ¶mflags))
|
||||
return NULL;
|
||||
if (paramflags == Py_None)
|
||||
paramflags = NULL;
|
||||
|
||||
ftuple = PySequence_Tuple(ftuple);
|
||||
if (!ftuple)
|
||||
|
|
@ -4135,8 +4139,10 @@ PyCFuncPtr_FromVtblIndex(PyTypeObject *type, PyObject *args, PyObject *kwds)
|
|||
GUID *iid = NULL;
|
||||
Py_ssize_t iid_len = 0;
|
||||
|
||||
if (!PyArg_ParseTuple(args, "is|O?z#", &index, &name, ¶mflags, &iid, &iid_len))
|
||||
if (!PyArg_ParseTuple(args, "is|Oz#", &index, &name, ¶mflags, &iid, &iid_len))
|
||||
return NULL;
|
||||
if (paramflags == Py_None)
|
||||
paramflags = NULL;
|
||||
|
||||
ctypes_state *st = get_module_state_by_def(Py_TYPE(type));
|
||||
if (!_validate_paramflags(st, type, paramflags)) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue