mirror of
https://github.com/python/cpython.git
synced 2025-12-23 09:19:18 +00:00
merge
This commit is contained in:
commit
ee205dc7d8
3 changed files with 19 additions and 2 deletions
|
|
@ -4109,14 +4109,17 @@ repeat_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
|
|||
{
|
||||
repeatobject *ro;
|
||||
PyObject *element;
|
||||
Py_ssize_t cnt = -1;
|
||||
Py_ssize_t cnt = -1, n_kwds = 0;
|
||||
static char *kwargs[] = {"object", "times", NULL};
|
||||
|
||||
if (!PyArg_ParseTupleAndKeywords(args, kwds, "O|n:repeat", kwargs,
|
||||
&element, &cnt))
|
||||
return NULL;
|
||||
|
||||
if (PyTuple_Size(args) == 2 && cnt < 0)
|
||||
if (kwds != NULL)
|
||||
n_kwds = PyDict_Size(kwds);
|
||||
/* Does user supply times argument? */
|
||||
if ((PyTuple_Size(args) + n_kwds == 2) && cnt < 0)
|
||||
cnt = 0;
|
||||
|
||||
ro = (repeatobject *)type->tp_alloc(type, 0);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue