Skip to content

Commit def4fab

Browse files
committed
pythongh-92536: Argument Clinic no longer emits PyUnicode_READY()
Since Python 3.12, PyUnicode_READY() does nothing and always returns 0.
1 parent fc84e0c commit def4fab

File tree

6 files changed

+6
-57
lines changed

6 files changed

+6
-57
lines changed

Lib/test/clinic.test

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -354,9 +354,6 @@ test_unicode_converter(PyObject *module, PyObject *arg)
354354
_PyArg_BadArgument("test_unicode_converter", "argument", "str", arg);
355355
goto exit;
356356
}
357-
if (PyUnicode_READY(arg) == -1) {
358-
goto exit;
359-
}
360357
a = arg;
361358
return_value = test_unicode_converter_impl(module, a);
362359

@@ -366,7 +363,7 @@ exit:
366363

367364
static PyObject *
368365
test_unicode_converter_impl(PyObject *module, PyObject *a)
369-
/*[clinic end generated code: output=18f1e3880c862611 input=aa33612df92aa9c5]*/
366+
/*[clinic end generated code: output=8c1625cc272c1f3d input=aa33612df92aa9c5]*/
370367

371368

372369
/*[clinic input]
@@ -972,9 +969,6 @@ test_int_converter(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
972969
_PyArg_BadArgument("test_int_converter", "argument 3", "a unicode character", args[2]);
973970
goto exit;
974971
}
975-
if (PyUnicode_READY(args[2])) {
976-
goto exit;
977-
}
978972
if (PyUnicode_GET_LENGTH(args[2]) != 1) {
979973
_PyArg_BadArgument("test_int_converter", "argument 3", "a unicode character", args[2]);
980974
goto exit;
@@ -996,7 +990,7 @@ exit:
996990

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

1001995

1002996
/*[clinic input]

Modules/clinic/_testclinic.c.h

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

Modules/clinic/arraymodule.c.h

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

Modules/clinic/unicodedata.c.h

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

PC/clinic/msvcrtmodule.c.h

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

Tools/clinic/clinic.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3266,9 +3266,6 @@ def parse_arg(self, argname: str, displayname: str) -> str:
32663266
_PyArg_BadArgument("{{name}}", {displayname}, "a unicode character", {argname});
32673267
goto exit;
32683268
}}}}
3269-
if (PyUnicode_READY({argname})) {{{{
3270-
goto exit;
3271-
}}}}
32723269
if (PyUnicode_GET_LENGTH({argname}) != 1) {{{{
32733270
_PyArg_BadArgument("{{name}}", {displayname}, "a unicode character", {argname});
32743271
goto exit;

0 commit comments

Comments
 (0)