@@ -1612,12 +1612,17 @@ test_Py_ssize_t_converter
1612
1612
a: Py_ssize_t = 12
1613
1613
b: Py_ssize_t(accept={int}) = 34
1614
1614
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
1615
1619
/
1616
1620
1617
1621
[clinic start generated code]*/
1618
1622
1619
1623
PyDoc_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"
1621
1626
"--\n"
1622
1627
"\n" );
1623
1628
@@ -1626,7 +1631,8 @@ PyDoc_STRVAR(test_Py_ssize_t_converter__doc__,
1626
1631
1627
1632
static PyObject *
1628
1633
test_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 );
1630
1636
1631
1637
static PyObject *
1632
1638
test_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
1635
1641
Py_ssize_t a = 12 ;
1636
1642
Py_ssize_t b = 34 ;
1637
1643
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 ;
1638
1648
1639
- if (!_PyArg_CheckPositional ("test_Py_ssize_t_converter" , nargs , 0 , 3 )) {
1649
+ if (!_PyArg_CheckPositional ("test_Py_ssize_t_converter" , nargs , 0 , 7 )) {
1640
1650
goto exit ;
1641
1651
}
1642
1652
if (nargs < 1 ) {
@@ -1675,17 +1685,65 @@ test_Py_ssize_t_converter(PyObject *module, PyObject *const *args, Py_ssize_t na
1675
1685
if (!_Py_convert_optional_to_ssize_t (args [2 ], & c )) {
1676
1686
goto exit ;
1677
1687
}
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
+ }
1678
1735
skip_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 );
1680
1737
1681
1738
exit :
1682
1739
return return_value ;
1683
1740
}
1684
1741
1685
1742
static PyObject *
1686
1743
test_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]*/
1689
1747
1690
1748
1691
1749
/*[clinic input]
0 commit comments