Skip to content

Commit 56851ae

Browse files
committed
Apply suggestions from review
1 parent a317020 commit 56851ae

File tree

5 files changed

+18
-17
lines changed

5 files changed

+18
-17
lines changed

Lib/test/clinic.test.c

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1614,15 +1614,15 @@ test_Py_ssize_t_converter
16141614
c: Py_ssize_t(accept={int, NoneType}) = 56
16151615
d: Py_ssize_t(accept={int}, allow_negative=False) = 78
16161616
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
1617+
f: Py_ssize_t(accept={int}, allow_negative=True) = -12
1618+
g: Py_ssize_t(accept={int, NoneType}, allow_negative=True) = -34
16191619
/
16201620
16211621
[clinic start generated code]*/
16221622

16231623
PyDoc_STRVAR(test_Py_ssize_t_converter__doc__,
1624-
"test_Py_ssize_t_converter($module, a=12, b=34, c=56, d=78, e=90, f=12,\n"
1625-
" g=34, /)\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"
16261626
"--\n"
16271627
"\n");
16281628

@@ -1643,8 +1643,8 @@ test_Py_ssize_t_converter(PyObject *module, PyObject *const *args, Py_ssize_t na
16431643
Py_ssize_t c = 56;
16441644
Py_ssize_t d = 78;
16451645
Py_ssize_t e = 90;
1646-
Py_ssize_t f = 12;
1647-
Py_ssize_t g = 34;
1646+
Py_ssize_t f = -12;
1647+
Py_ssize_t g = -34;
16481648

16491649
if (!_PyArg_CheckPositional("test_Py_ssize_t_converter", nargs, 0, 7)) {
16501650
goto exit;
@@ -1743,7 +1743,7 @@ static PyObject *
17431743
test_Py_ssize_t_converter_impl(PyObject *module, Py_ssize_t a, Py_ssize_t b,
17441744
Py_ssize_t c, Py_ssize_t d, Py_ssize_t e,
17451745
Py_ssize_t f, Py_ssize_t g)
1746-
/*[clinic end generated code: output=8721e4925ea46578 input=0d80cb5c942b6e0f]*/
1746+
/*[clinic end generated code: output=2034b285dd317556 input=a25bac8ecf2890aa]*/
17471747

17481748

17491749
/*[clinic input]

Lib/test/test_clinic.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3211,8 +3211,8 @@ def test_py_ssize_t_converter(self):
32113211
ac_tester.py_ssize_t_converter(12, 34, 56, -1)
32123212
with self.assertRaises(ValueError):
32133213
ac_tester.py_ssize_t_converter(12, 34, 56, 78, -1)
3214-
self.assertEqual(ac_tester.py_ssize_t_converter(), (12, 34, 56, 78, 90, -1, -1))
3215-
self.assertEqual(ac_tester.py_ssize_t_converter(1, 2, None, 3, None, 4, None), (1, 2, 56, 3, 90, 4, -1))
3214+
self.assertEqual(ac_tester.py_ssize_t_converter(), (12, 34, 56, 78, 90, -12, -34))
3215+
self.assertEqual(ac_tester.py_ssize_t_converter(1, 2, None, 3, None, 4, None), (1, 2, 56, 3, 90, 4, -34))
32163216

32173217
def test_slice_index_converter(self):
32183218
from _testcapi import PY_SSIZE_T_MIN, PY_SSIZE_T_MAX

Modules/_testclinic.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -445,8 +445,8 @@ py_ssize_t_converter
445445
c: Py_ssize_t(accept={int, NoneType}) = 56
446446
d: Py_ssize_t(accept={int}, allow_negative=False) = 78
447447
e: Py_ssize_t(accept={int, NoneType}, allow_negative=False) = 90
448-
f: Py_ssize_t(accept={int}, allow_negative=False) = -1
449-
g: Py_ssize_t(accept={int, NoneType}, allow_negative=False) = -1
448+
f: Py_ssize_t(accept={int}, allow_negative=False) = -12
449+
g: Py_ssize_t(accept={int, NoneType}, allow_negative=False) = -34
450450
/
451451
452452
[clinic start generated code]*/
@@ -455,7 +455,7 @@ static PyObject *
455455
py_ssize_t_converter_impl(PyObject *module, Py_ssize_t a, Py_ssize_t b,
456456
Py_ssize_t c, Py_ssize_t d, Py_ssize_t e,
457457
Py_ssize_t f, Py_ssize_t g)
458-
/*[clinic end generated code: output=ecf8e1a4a9abc95e input=d4571dd2ba885665]*/
458+
/*[clinic end generated code: output=ecf8e1a4a9abc95e input=d3b8f1f6efccf4b2]*/
459459
{
460460
RETURN_PACKED_ARGS(7, PyLong_FromSsize_t, Py_ssize_t, a, b, c, d, e, f, g);
461461
}

Modules/clinic/_testclinic.c.h

Lines changed: 5 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Python/modsupport.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ _Py_convert_optional_to_non_negative_ssize_t(PyObject *obj, void *result)
4646
return 1;
4747
}
4848

49+
4950
/* Helper for mkvalue() to scan the length of a format */
5051

5152
static Py_ssize_t

0 commit comments

Comments
 (0)