mirror of
https://github.com/python/cpython.git
synced 2025-08-03 16:39:00 +00:00
bpo-31655: Validate keyword names in SimpleNamespace constructor. (#3909)
This commit is contained in:
parent
28f713601d
commit
79ba471488
2 changed files with 7 additions and 1 deletions
|
@ -44,8 +44,12 @@ namespace_init(_PyNamespaceObject *ns, PyObject *args, PyObject *kwds)
|
|||
PyErr_Format(PyExc_TypeError, "no positional arguments expected");
|
||||
return -1;
|
||||
}
|
||||
if (kwds == NULL)
|
||||
if (kwds == NULL) {
|
||||
return 0;
|
||||
}
|
||||
if (!PyArg_ValidateKeywordArguments(kwds)) {
|
||||
return -1;
|
||||
}
|
||||
return PyDict_Update(ns->ns_dict, kwds);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue