Skip to content

Commit 4e5a728

Browse files
authored
gh-108444: Argument Clinic uses PyLong_AsInt() (#108458)
Argument Clinic now uses the new public PyLong_AsInt(), rather than the old name _PyLong_AsInt().
1 parent be800f4 commit 4e5a728

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

73 files changed

+467
-466
lines changed

Lib/test/clinic.test.c

+12-12
Original file line numberDiff line numberDiff line change
@@ -473,7 +473,7 @@ test_bool_converter(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
473473
if (nargs < 3) {
474474
goto skip_optional;
475475
}
476-
c = _PyLong_AsInt(args[2]);
476+
c = PyLong_AsInt(args[2]);
477477
if (c == -1 && PyErr_Occurred()) {
478478
goto exit;
479479
}
@@ -486,7 +486,7 @@ test_bool_converter(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
486486

487487
static PyObject *
488488
test_bool_converter_impl(PyObject *module, int a, int b, int c)
489-
/*[clinic end generated code: output=27f0e653a70b9be3 input=939854fa9f248c60]*/
489+
/*[clinic end generated code: output=3190e46490de0644 input=939854fa9f248c60]*/
490490

491491

492492
/*[clinic input]
@@ -1009,14 +1009,14 @@ test_int_converter(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
10091009
if (nargs < 1) {
10101010
goto skip_optional;
10111011
}
1012-
a = _PyLong_AsInt(args[0]);
1012+
a = PyLong_AsInt(args[0]);
10131013
if (a == -1 && PyErr_Occurred()) {
10141014
goto exit;
10151015
}
10161016
if (nargs < 2) {
10171017
goto skip_optional;
10181018
}
1019-
b = _PyLong_AsInt(args[1]);
1019+
b = PyLong_AsInt(args[1]);
10201020
if (b == -1 && PyErr_Occurred()) {
10211021
goto exit;
10221022
}
@@ -1035,7 +1035,7 @@ test_int_converter(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
10351035
if (nargs < 4) {
10361036
goto skip_optional;
10371037
}
1038-
d = _PyLong_AsInt(args[3]);
1038+
d = PyLong_AsInt(args[3]);
10391039
if (d == -1 && PyErr_Occurred()) {
10401040
goto exit;
10411041
}
@@ -1048,7 +1048,7 @@ test_int_converter(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
10481048

10491049
static PyObject *
10501050
test_int_converter_impl(PyObject *module, int a, int b, int c, myenum d)
1051-
/*[clinic end generated code: output=375eedba5ca9a5b3 input=d20541fc1ca0553e]*/
1051+
/*[clinic end generated code: output=5aed87a7589eefb2 input=d20541fc1ca0553e]*/
10521052

10531053

10541054
/*[clinic input]
@@ -4509,7 +4509,7 @@ Test_cls_with_param(TestObj *self, PyTypeObject *cls, PyObject *const *args, Py_
45094509
if (!args) {
45104510
goto exit;
45114511
}
4512-
a = _PyLong_AsInt(args[0]);
4512+
a = PyLong_AsInt(args[0]);
45134513
if (a == -1 && PyErr_Occurred()) {
45144514
goto exit;
45154515
}
@@ -4521,7 +4521,7 @@ Test_cls_with_param(TestObj *self, PyTypeObject *cls, PyObject *const *args, Py_
45214521

45224522
static PyObject *
45234523
Test_cls_with_param_impl(TestObj *self, PyTypeObject *cls, int a)
4524-
/*[clinic end generated code: output=00218e7f583e6c81 input=af158077bd237ef9]*/
4524+
/*[clinic end generated code: output=d89b99e83d442be0 input=af158077bd237ef9]*/
45254525

45264526

45274527
/*[clinic input]
@@ -4703,7 +4703,7 @@ Test_an_metho_arg_named_arg(TestObj *self, PyObject *arg_)
47034703
PyObject *return_value = NULL;
47044704
int arg;
47054705

4706-
arg = _PyLong_AsInt(arg_);
4706+
arg = PyLong_AsInt(arg_);
47074707
if (arg == -1 && PyErr_Occurred()) {
47084708
goto exit;
47094709
}
@@ -4715,7 +4715,7 @@ Test_an_metho_arg_named_arg(TestObj *self, PyObject *arg_)
47154715

47164716
static PyObject *
47174717
Test_an_metho_arg_named_arg_impl(TestObj *self, int arg)
4718-
/*[clinic end generated code: output=7d590626642194ae input=2a53a57cf5624f95]*/
4718+
/*[clinic end generated code: output=9f04de4a62287e28 input=2a53a57cf5624f95]*/
47194719

47204720

47214721
/*[clinic input]
@@ -5062,7 +5062,7 @@ mangled_c_keyword_identifier(PyObject *module, PyObject *const *args, Py_ssize_t
50625062
if (!args) {
50635063
goto exit;
50645064
}
5065-
int_value = _PyLong_AsInt(args[0]);
5065+
int_value = PyLong_AsInt(args[0]);
50665066
if (int_value == -1 && PyErr_Occurred()) {
50675067
goto exit;
50685068
}
@@ -5074,7 +5074,7 @@ mangled_c_keyword_identifier(PyObject *module, PyObject *const *args, Py_ssize_t
50745074

50755075
static PyObject *
50765076
mangled_c_keyword_identifier_impl(PyObject *module, int int_value)
5077-
/*[clinic end generated code: output=c049d7d79be26cda input=060876448ab567a2]*/
5077+
/*[clinic end generated code: output=f24b37e0368e0eb8 input=060876448ab567a2]*/
50785078

50795079

50805080
/*[clinic input]

Lib/test/test_clinic.py

+3-2
Original file line numberDiff line numberDiff line change
@@ -2463,11 +2463,12 @@ def test_cli_force(self):
24632463
# Verify by checking the checksum.
24642464
checksum = (
24652465
"/*[clinic end generated code: "
2466-
"output=2124c291eb067d76 input=9543a8d2da235301]*/\n"
2466+
"output=c16447c01510dfb3 input=9543a8d2da235301]*/\n"
24672467
)
24682468
with open(fn, 'r', encoding='utf-8') as f:
24692469
generated = f.read()
2470-
self.assertTrue(generated.endswith(checksum))
2470+
self.assertTrue(generated.endswith(checksum),
2471+
(generated, checksum))
24712472

24722473
def test_cli_make(self):
24732474
c_code = dedent("""

Modules/_blake2/clinic/blake2b_impl.c.h

+6-6
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Modules/_blake2/clinic/blake2s_impl.c.h

+6-6
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Modules/_io/clinic/_iomodule.c.h

+3-3
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Modules/_io/clinic/bufferedio.c.h

+4-4
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Modules/_io/clinic/bytesio.c.h

+2-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Modules/_io/clinic/fileio.c.h

+2-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Modules/_io/clinic/iobase.c.h

+3-3
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Modules/_io/clinic/stringio.c.h

+2-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Modules/_io/clinic/textio.c.h

+4-4
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Modules/_multiprocessing/clinic/multiprocessing.c.h

+2-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)