@@ -1612,12 +1612,17 @@ test_Py_ssize_t_converter
16121612 a: Py_ssize_t = 12
16131613 b: Py_ssize_t(accept={int}) = 34
16141614 c: Py_ssize_t(accept={int, NoneType}) = 56
1615+ d: Py_ssize_t(accept={int}, allow_negative=False) = 78
1616+ e: Py_ssize_t(accept={int, NoneType}, allow_negative=False) = 90
1617+ f: Py_ssize_t(accept={int}, allow_negative=True) = -12
1618+ g: Py_ssize_t(accept={int, NoneType}, allow_negative=True) = -34
16151619 /
16161620
16171621[clinic start generated code]*/
16181622
16191623PyDoc_STRVAR (test_Py_ssize_t_converter__doc__ ,
1620- "test_Py_ssize_t_converter($module, a=12, b=34, c=56, /)\n"
1624+ "test_Py_ssize_t_converter($module, a=12, b=34, c=56, d=78, e=90, f=-12,\n"
1625+ " g=-34, /)\n"
16211626"--\n"
16221627"\n" );
16231628
@@ -1626,7 +1631,8 @@ PyDoc_STRVAR(test_Py_ssize_t_converter__doc__,
16261631
16271632static PyObject *
16281633test_Py_ssize_t_converter_impl (PyObject * module , Py_ssize_t a , Py_ssize_t b ,
1629- Py_ssize_t c );
1634+ Py_ssize_t c , Py_ssize_t d , Py_ssize_t e ,
1635+ Py_ssize_t f , Py_ssize_t g );
16301636
16311637static PyObject *
16321638test_Py_ssize_t_converter (PyObject * module , PyObject * const * args , Py_ssize_t nargs )
@@ -1635,8 +1641,12 @@ test_Py_ssize_t_converter(PyObject *module, PyObject *const *args, Py_ssize_t na
16351641 Py_ssize_t a = 12 ;
16361642 Py_ssize_t b = 34 ;
16371643 Py_ssize_t c = 56 ;
1644+ Py_ssize_t d = 78 ;
1645+ Py_ssize_t e = 90 ;
1646+ Py_ssize_t f = -12 ;
1647+ Py_ssize_t g = -34 ;
16381648
1639- if (!_PyArg_CheckPositional ("test_Py_ssize_t_converter" , nargs , 0 , 3 )) {
1649+ if (!_PyArg_CheckPositional ("test_Py_ssize_t_converter" , nargs , 0 , 7 )) {
16401650 goto exit ;
16411651 }
16421652 if (nargs < 1 ) {
@@ -1675,17 +1685,65 @@ test_Py_ssize_t_converter(PyObject *module, PyObject *const *args, Py_ssize_t na
16751685 if (!_Py_convert_optional_to_ssize_t (args [2 ], & c )) {
16761686 goto exit ;
16771687 }
1688+ if (nargs < 4 ) {
1689+ goto skip_optional ;
1690+ }
1691+ {
1692+ Py_ssize_t ival = -1 ;
1693+ PyObject * iobj = _PyNumber_Index (args [3 ]);
1694+ if (iobj != NULL ) {
1695+ ival = PyLong_AsSsize_t (iobj );
1696+ Py_DECREF (iobj );
1697+ }
1698+ if (ival == -1 && PyErr_Occurred ()) {
1699+ goto exit ;
1700+ }
1701+ d = ival ;
1702+ if (d < 0 ) {
1703+ PyErr_SetString (PyExc_ValueError ,
1704+ "d cannot be negative" );
1705+ goto exit ;
1706+ }
1707+ }
1708+ if (nargs < 5 ) {
1709+ goto skip_optional ;
1710+ }
1711+ if (!_Py_convert_optional_to_non_negative_ssize_t (args [4 ], & e )) {
1712+ goto exit ;
1713+ }
1714+ if (nargs < 6 ) {
1715+ goto skip_optional ;
1716+ }
1717+ {
1718+ Py_ssize_t ival = -1 ;
1719+ PyObject * iobj = _PyNumber_Index (args [5 ]);
1720+ if (iobj != NULL ) {
1721+ ival = PyLong_AsSsize_t (iobj );
1722+ Py_DECREF (iobj );
1723+ }
1724+ if (ival == -1 && PyErr_Occurred ()) {
1725+ goto exit ;
1726+ }
1727+ f = ival ;
1728+ }
1729+ if (nargs < 7 ) {
1730+ goto skip_optional ;
1731+ }
1732+ if (!_Py_convert_optional_to_ssize_t (args [6 ], & g )) {
1733+ goto exit ;
1734+ }
16781735skip_optional :
1679- return_value = test_Py_ssize_t_converter_impl (module , a , b , c );
1736+ return_value = test_Py_ssize_t_converter_impl (module , a , b , c , d , e , f , g );
16801737
16811738exit :
16821739 return return_value ;
16831740}
16841741
16851742static PyObject *
16861743test_Py_ssize_t_converter_impl (PyObject * module , Py_ssize_t a , Py_ssize_t b ,
1687- Py_ssize_t c )
1688- /*[clinic end generated code: output=48214bc3d01f4dd7 input=3855f184bb3f299d]*/
1744+ Py_ssize_t c , Py_ssize_t d , Py_ssize_t e ,
1745+ Py_ssize_t f , Py_ssize_t g )
1746+ /*[clinic end generated code: output=4ae0a56a1447fba9 input=a25bac8ecf2890aa]*/
16891747
16901748
16911749/*[clinic input]
0 commit comments