diff options
Diffstat (limited to 'Modules/clinic/_collectionsmodule.c.h')
-rw-r--r-- | Modules/clinic/_collectionsmodule.c.h | 23 |
1 files changed, 20 insertions, 3 deletions
diff --git a/Modules/clinic/_collectionsmodule.c.h b/Modules/clinic/_collectionsmodule.c.h index 12626c1..ed3b1b5 100644 --- a/Modules/clinic/_collectionsmodule.c.h +++ b/Modules/clinic/_collectionsmodule.c.h @@ -16,13 +16,30 @@ tuplegetter_new(PyTypeObject *type, PyObject *args, PyObject *kwargs) !_PyArg_NoKeywords("_tuplegetter", kwargs)) { goto exit; } - if (!PyArg_ParseTuple(args, "nO:_tuplegetter", - &index, &doc)) { + if (!_PyArg_CheckPositional("_tuplegetter", PyTuple_GET_SIZE(args), 2, 2)) { goto exit; } + if (PyFloat_Check(PyTuple_GET_ITEM(args, 0))) { + PyErr_SetString(PyExc_TypeError, + "integer argument expected, got float" ); + goto exit; + } + { + Py_ssize_t ival = -1; + PyObject *iobj = PyNumber_Index(PyTuple_GET_ITEM(args, 0)); + if (iobj != NULL) { + ival = PyLong_AsSsize_t(iobj); + Py_DECREF(iobj); + } + if (ival == -1 && PyErr_Occurred()) { + goto exit; + } + index = ival; + } + doc = PyTuple_GET_ITEM(args, 1); return_value = tuplegetter_new_impl(type, index, doc); exit: return return_value; } -/*[clinic end generated code: output=83746071eacc28d3 input=a9049054013a1b77]*/ +/*[clinic end generated code: output=51bd572577ca7111 input=a9049054013a1b77]*/ |