Skip to content

gh-108444: Argument Clinic uses PyLong_AsInt() #108458

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Aug 24, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 12 additions & 12 deletions Lib/test/clinic.test.c
Original file line number Diff line number Diff line change
Expand Up @@ -473,7 +473,7 @@ test_bool_converter(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
if (nargs < 3) {
goto skip_optional;
}
c = _PyLong_AsInt(args[2]);
c = PyLong_AsInt(args[2]);
if (c == -1 && PyErr_Occurred()) {
goto exit;
}
Expand All @@ -486,7 +486,7 @@ test_bool_converter(PyObject *module, PyObject *const *args, Py_ssize_t nargs)

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


/*[clinic input]
Expand Down Expand Up @@ -1009,14 +1009,14 @@ test_int_converter(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
if (nargs < 1) {
goto skip_optional;
}
a = _PyLong_AsInt(args[0]);
a = PyLong_AsInt(args[0]);
if (a == -1 && PyErr_Occurred()) {
goto exit;
}
if (nargs < 2) {
goto skip_optional;
}
b = _PyLong_AsInt(args[1]);
b = PyLong_AsInt(args[1]);
if (b == -1 && PyErr_Occurred()) {
goto exit;
}
Expand All @@ -1035,7 +1035,7 @@ test_int_converter(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
if (nargs < 4) {
goto skip_optional;
}
d = _PyLong_AsInt(args[3]);
d = PyLong_AsInt(args[3]);
if (d == -1 && PyErr_Occurred()) {
goto exit;
}
Expand All @@ -1048,7 +1048,7 @@ test_int_converter(PyObject *module, PyObject *const *args, Py_ssize_t nargs)

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


/*[clinic input]
Expand Down Expand Up @@ -4509,7 +4509,7 @@ Test_cls_with_param(TestObj *self, PyTypeObject *cls, PyObject *const *args, Py_
if (!args) {
goto exit;
}
a = _PyLong_AsInt(args[0]);
a = PyLong_AsInt(args[0]);
if (a == -1 && PyErr_Occurred()) {
goto exit;
}
Expand All @@ -4521,7 +4521,7 @@ Test_cls_with_param(TestObj *self, PyTypeObject *cls, PyObject *const *args, Py_

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


/*[clinic input]
Expand Down Expand Up @@ -4703,7 +4703,7 @@ Test_an_metho_arg_named_arg(TestObj *self, PyObject *arg_)
PyObject *return_value = NULL;
int arg;

arg = _PyLong_AsInt(arg_);
arg = PyLong_AsInt(arg_);
if (arg == -1 && PyErr_Occurred()) {
goto exit;
}
Expand All @@ -4715,7 +4715,7 @@ Test_an_metho_arg_named_arg(TestObj *self, PyObject *arg_)

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


/*[clinic input]
Expand Down Expand Up @@ -5062,7 +5062,7 @@ mangled_c_keyword_identifier(PyObject *module, PyObject *const *args, Py_ssize_t
if (!args) {
goto exit;
}
int_value = _PyLong_AsInt(args[0]);
int_value = PyLong_AsInt(args[0]);
if (int_value == -1 && PyErr_Occurred()) {
goto exit;
}
Expand All @@ -5074,7 +5074,7 @@ mangled_c_keyword_identifier(PyObject *module, PyObject *const *args, Py_ssize_t

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


/*[clinic input]
Expand Down
5 changes: 3 additions & 2 deletions Lib/test/test_clinic.py
Original file line number Diff line number Diff line change
Expand Up @@ -2463,11 +2463,12 @@ def test_cli_force(self):
# Verify by checking the checksum.
checksum = (
"/*[clinic end generated code: "
"output=2124c291eb067d76 input=9543a8d2da235301]*/\n"
"output=c16447c01510dfb3 input=9543a8d2da235301]*/\n"
)
with open(fn, 'r', encoding='utf-8') as f:
generated = f.read()
self.assertTrue(generated.endswith(checksum))
self.assertTrue(generated.endswith(checksum),
(generated, checksum))

def test_cli_make(self):
c_code = dedent("""
Expand Down
12 changes: 6 additions & 6 deletions Modules/_blake2/clinic/blake2b_impl.c.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 6 additions & 6 deletions Modules/_blake2/clinic/blake2s_impl.c.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions Modules/_io/clinic/_iomodule.c.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions Modules/_io/clinic/bufferedio.c.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions Modules/_io/clinic/bytesio.c.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions Modules/_io/clinic/fileio.c.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions Modules/_io/clinic/iobase.c.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions Modules/_io/clinic/stringio.c.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions Modules/_io/clinic/textio.c.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions Modules/_multiprocessing/clinic/multiprocessing.c.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading