Skip to content

Commit

Permalink
gh-92536: Argument Clinic no longer emits PyUnicode_READY() (#105208)
Browse files Browse the repository at this point in the history
Since Python 3.12, PyUnicode_READY() does nothing and always
returns 0.

Argument Clinic now also checks for .cpp files (PC/_wmimodule.cpp).
  • Loading branch information
vstinner authored and pull[bot] committed Sep 13, 2023
1 parent 09b328c commit 1407514
Show file tree
Hide file tree
Showing 35 changed files with 37 additions and 321 deletions.
10 changes: 2 additions & 8 deletions Lib/test/clinic.test
Original file line number Diff line number Diff line change
Expand Up @@ -354,9 +354,6 @@ test_unicode_converter(PyObject *module, PyObject *arg)
_PyArg_BadArgument("test_unicode_converter", "argument", "str", arg);
goto exit;
}
if (PyUnicode_READY(arg) == -1) {
goto exit;
}
a = arg;
return_value = test_unicode_converter_impl(module, a);

Expand All @@ -366,7 +363,7 @@ exit:

static PyObject *
test_unicode_converter_impl(PyObject *module, PyObject *a)
/*[clinic end generated code: output=18f1e3880c862611 input=aa33612df92aa9c5]*/
/*[clinic end generated code: output=8c1625cc272c1f3d input=aa33612df92aa9c5]*/


/*[clinic input]
Expand Down Expand Up @@ -972,9 +969,6 @@ test_int_converter(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
_PyArg_BadArgument("test_int_converter", "argument 3", "a unicode character", args[2]);
goto exit;
}
if (PyUnicode_READY(args[2])) {
goto exit;
}
if (PyUnicode_GET_LENGTH(args[2]) != 1) {
_PyArg_BadArgument("test_int_converter", "argument 3", "a unicode character", args[2]);
goto exit;
Expand All @@ -996,7 +990,7 @@ exit:

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


/*[clinic input]
Expand Down
5 changes: 1 addition & 4 deletions Modules/_io/clinic/_iomodule.c.h

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

5 changes: 1 addition & 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.

8 changes: 1 addition & 7 deletions Modules/_multiprocessing/clinic/posixshmem.c.h

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

8 changes: 1 addition & 7 deletions Modules/_sqlite/clinic/connection.c.h

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

8 changes: 1 addition & 7 deletions Modules/_sqlite/clinic/cursor.c.h

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

5 changes: 1 addition & 4 deletions Modules/_sqlite/clinic/module.c.h

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

53 changes: 1 addition & 52 deletions Modules/clinic/_codecsmodule.c.h

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

11 changes: 1 addition & 10 deletions Modules/clinic/_localemodule.c.h

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

8 changes: 1 addition & 7 deletions Modules/clinic/_testclinic.c.h

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

Loading

0 comments on commit 1407514

Please sign in to comment.