mirror of
https://github.com/python/cpython.git
synced 2025-09-26 10:19:53 +00:00
gh-92536: Argument Clinic no longer emits PyUnicode_READY() (#105208)
Since Python 3.12, PyUnicode_READY() does nothing and always returns 0. Argument Clinic now also checks for .cpp files (PC/_wmimodule.cpp).
This commit is contained in:
parent
146939306a
commit
cbb9ba844f
35 changed files with 37 additions and 321 deletions
23
Objects/clinic/unicodeobject.c.h
generated
23
Objects/clinic/unicodeobject.c.h
generated
|
@ -770,17 +770,11 @@ unicode_replace(PyObject *self, PyObject *const *args, Py_ssize_t nargs)
|
|||
_PyArg_BadArgument("replace", "argument 1", "str", args[0]);
|
||||
goto exit;
|
||||
}
|
||||
if (PyUnicode_READY(args[0]) == -1) {
|
||||
goto exit;
|
||||
}
|
||||
old = args[0];
|
||||
if (!PyUnicode_Check(args[1])) {
|
||||
_PyArg_BadArgument("replace", "argument 2", "str", args[1]);
|
||||
goto exit;
|
||||
}
|
||||
if (PyUnicode_READY(args[1]) == -1) {
|
||||
goto exit;
|
||||
}
|
||||
new = args[1];
|
||||
if (nargs < 3) {
|
||||
goto skip_optional;
|
||||
|
@ -829,9 +823,6 @@ unicode_removeprefix(PyObject *self, PyObject *arg)
|
|||
_PyArg_BadArgument("removeprefix", "argument", "str", arg);
|
||||
goto exit;
|
||||
}
|
||||
if (PyUnicode_READY(arg) == -1) {
|
||||
goto exit;
|
||||
}
|
||||
prefix = arg;
|
||||
return_value = unicode_removeprefix_impl(self, prefix);
|
||||
|
||||
|
@ -865,9 +856,6 @@ unicode_removesuffix(PyObject *self, PyObject *arg)
|
|||
_PyArg_BadArgument("removesuffix", "argument", "str", arg);
|
||||
goto exit;
|
||||
}
|
||||
if (PyUnicode_READY(arg) == -1) {
|
||||
goto exit;
|
||||
}
|
||||
suffix = arg;
|
||||
return_value = unicode_removesuffix_impl(self, suffix);
|
||||
|
||||
|
@ -1261,9 +1249,6 @@ unicode_maketrans(void *null, PyObject *const *args, Py_ssize_t nargs)
|
|||
_PyArg_BadArgument("maketrans", "argument 2", "str", args[1]);
|
||||
goto exit;
|
||||
}
|
||||
if (PyUnicode_READY(args[1]) == -1) {
|
||||
goto exit;
|
||||
}
|
||||
y = args[1];
|
||||
if (nargs < 3) {
|
||||
goto skip_optional;
|
||||
|
@ -1272,9 +1257,6 @@ unicode_maketrans(void *null, PyObject *const *args, Py_ssize_t nargs)
|
|||
_PyArg_BadArgument("maketrans", "argument 3", "str", args[2]);
|
||||
goto exit;
|
||||
}
|
||||
if (PyUnicode_READY(args[2]) == -1) {
|
||||
goto exit;
|
||||
}
|
||||
z = args[2];
|
||||
skip_optional:
|
||||
return_value = unicode_maketrans_impl(x, y, z);
|
||||
|
@ -1378,9 +1360,6 @@ unicode___format__(PyObject *self, PyObject *arg)
|
|||
_PyArg_BadArgument("__format__", "argument", "str", arg);
|
||||
goto exit;
|
||||
}
|
||||
if (PyUnicode_READY(arg) == -1) {
|
||||
goto exit;
|
||||
}
|
||||
format_spec = arg;
|
||||
return_value = unicode___format___impl(self, format_spec);
|
||||
|
||||
|
@ -1497,4 +1476,4 @@ skip_optional_pos:
|
|||
exit:
|
||||
return return_value;
|
||||
}
|
||||
/*[clinic end generated code: output=05d942840635dadf input=a9049054013a1b77]*/
|
||||
/*[clinic end generated code: output=0a71c4aeffdf0bc5 input=a9049054013a1b77]*/
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue