mirror of
https://github.com/python/cpython.git
synced 2025-08-04 17:08:35 +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
5
Objects/clinic/bytearrayobject.c.h
generated
5
Objects/clinic/bytearrayobject.c.h
generated
|
@ -1120,9 +1120,6 @@ bytearray_fromhex(PyTypeObject *type, PyObject *arg)
|
|||
_PyArg_BadArgument("fromhex", "argument", "str", arg);
|
||||
goto exit;
|
||||
}
|
||||
if (PyUnicode_READY(arg) == -1) {
|
||||
goto exit;
|
||||
}
|
||||
string = arg;
|
||||
return_value = bytearray_fromhex_impl(type, string);
|
||||
|
||||
|
@ -1287,4 +1284,4 @@ bytearray_sizeof(PyByteArrayObject *self, PyObject *Py_UNUSED(ignored))
|
|||
{
|
||||
return bytearray_sizeof_impl(self);
|
||||
}
|
||||
/*[clinic end generated code: output=022698e8b0faa272 input=a9049054013a1b77]*/
|
||||
/*[clinic end generated code: output=99fb3e3b9c1f4b15 input=a9049054013a1b77]*/
|
||||
|
|
5
Objects/clinic/bytesobject.c.h
generated
5
Objects/clinic/bytesobject.c.h
generated
|
@ -875,9 +875,6 @@ bytes_fromhex(PyTypeObject *type, PyObject *arg)
|
|||
_PyArg_BadArgument("fromhex", "argument", "str", arg);
|
||||
goto exit;
|
||||
}
|
||||
if (PyUnicode_READY(arg) == -1) {
|
||||
goto exit;
|
||||
}
|
||||
string = arg;
|
||||
return_value = bytes_fromhex_impl(type, string);
|
||||
|
||||
|
@ -1063,4 +1060,4 @@ skip_optional_pos:
|
|||
exit:
|
||||
return return_value;
|
||||
}
|
||||
/*[clinic end generated code: output=31a9e4af85562612 input=a9049054013a1b77]*/
|
||||
/*[clinic end generated code: output=7b6e4e8b5bc4eb57 input=a9049054013a1b77]*/
|
||||
|
|
20
Objects/clinic/codeobject.c.h
generated
20
Objects/clinic/codeobject.c.h
generated
|
@ -105,25 +105,16 @@ code_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
|
|||
_PyArg_BadArgument("code", "argument 11", "str", PyTuple_GET_ITEM(args, 10));
|
||||
goto exit;
|
||||
}
|
||||
if (PyUnicode_READY(PyTuple_GET_ITEM(args, 10)) == -1) {
|
||||
goto exit;
|
||||
}
|
||||
filename = PyTuple_GET_ITEM(args, 10);
|
||||
if (!PyUnicode_Check(PyTuple_GET_ITEM(args, 11))) {
|
||||
_PyArg_BadArgument("code", "argument 12", "str", PyTuple_GET_ITEM(args, 11));
|
||||
goto exit;
|
||||
}
|
||||
if (PyUnicode_READY(PyTuple_GET_ITEM(args, 11)) == -1) {
|
||||
goto exit;
|
||||
}
|
||||
name = PyTuple_GET_ITEM(args, 11);
|
||||
if (!PyUnicode_Check(PyTuple_GET_ITEM(args, 12))) {
|
||||
_PyArg_BadArgument("code", "argument 13", "str", PyTuple_GET_ITEM(args, 12));
|
||||
goto exit;
|
||||
}
|
||||
if (PyUnicode_READY(PyTuple_GET_ITEM(args, 12)) == -1) {
|
||||
goto exit;
|
||||
}
|
||||
qualname = PyTuple_GET_ITEM(args, 12);
|
||||
firstlineno = _PyLong_AsInt(PyTuple_GET_ITEM(args, 13));
|
||||
if (firstlineno == -1 && PyErr_Occurred()) {
|
||||
|
@ -373,9 +364,6 @@ code_replace(PyCodeObject *self, PyObject *const *args, Py_ssize_t nargs, PyObje
|
|||
_PyArg_BadArgument("replace", "argument 'co_filename'", "str", args[13]);
|
||||
goto exit;
|
||||
}
|
||||
if (PyUnicode_READY(args[13]) == -1) {
|
||||
goto exit;
|
||||
}
|
||||
co_filename = args[13];
|
||||
if (!--noptargs) {
|
||||
goto skip_optional_kwonly;
|
||||
|
@ -386,9 +374,6 @@ code_replace(PyCodeObject *self, PyObject *const *args, Py_ssize_t nargs, PyObje
|
|||
_PyArg_BadArgument("replace", "argument 'co_name'", "str", args[14]);
|
||||
goto exit;
|
||||
}
|
||||
if (PyUnicode_READY(args[14]) == -1) {
|
||||
goto exit;
|
||||
}
|
||||
co_name = args[14];
|
||||
if (!--noptargs) {
|
||||
goto skip_optional_kwonly;
|
||||
|
@ -399,9 +384,6 @@ code_replace(PyCodeObject *self, PyObject *const *args, Py_ssize_t nargs, PyObje
|
|||
_PyArg_BadArgument("replace", "argument 'co_qualname'", "str", args[15]);
|
||||
goto exit;
|
||||
}
|
||||
if (PyUnicode_READY(args[15]) == -1) {
|
||||
goto exit;
|
||||
}
|
||||
co_qualname = args[15];
|
||||
if (!--noptargs) {
|
||||
goto skip_optional_kwonly;
|
||||
|
@ -488,4 +470,4 @@ code__varname_from_oparg(PyCodeObject *self, PyObject *const *args, Py_ssize_t n
|
|||
exit:
|
||||
return return_value;
|
||||
}
|
||||
/*[clinic end generated code: output=f1fab6e71c785182 input=a9049054013a1b77]*/
|
||||
/*[clinic end generated code: output=4ca4c0c403dbfa71 input=a9049054013a1b77]*/
|
||||
|
|
5
Objects/clinic/complexobject.c.h
generated
5
Objects/clinic/complexobject.c.h
generated
|
@ -65,9 +65,6 @@ complex___format__(PyComplexObject *self, PyObject *arg)
|
|||
_PyArg_BadArgument("__format__", "argument", "str", arg);
|
||||
goto exit;
|
||||
}
|
||||
if (PyUnicode_READY(arg) == -1) {
|
||||
goto exit;
|
||||
}
|
||||
format_spec = arg;
|
||||
return_value = complex___format___impl(self, format_spec);
|
||||
|
||||
|
@ -160,4 +157,4 @@ skip_optional_pos:
|
|||
exit:
|
||||
return return_value;
|
||||
}
|
||||
/*[clinic end generated code: output=52e85a1e258425d6 input=a9049054013a1b77]*/
|
||||
/*[clinic end generated code: output=d438b7ed87f8459e input=a9049054013a1b77]*/
|
||||
|
|
5
Objects/clinic/floatobject.c.h
generated
5
Objects/clinic/floatobject.c.h
generated
|
@ -316,13 +316,10 @@ float___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 = float___format___impl(self, format_spec);
|
||||
|
||||
exit:
|
||||
return return_value;
|
||||
}
|
||||
/*[clinic end generated code: output=ea329577074911b9 input=a9049054013a1b77]*/
|
||||
/*[clinic end generated code: output=355c3f5102034a41 input=a9049054013a1b77]*/
|
||||
|
|
11
Objects/clinic/longobject.c.h
generated
11
Objects/clinic/longobject.c.h
generated
|
@ -107,9 +107,6 @@ int___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 = int___format___impl(self, format_spec);
|
||||
|
||||
|
@ -346,9 +343,6 @@ int_to_bytes(PyObject *self, PyObject *const *args, Py_ssize_t nargs, PyObject *
|
|||
_PyArg_BadArgument("to_bytes", "argument 'byteorder'", "str", args[1]);
|
||||
goto exit;
|
||||
}
|
||||
if (PyUnicode_READY(args[1]) == -1) {
|
||||
goto exit;
|
||||
}
|
||||
byteorder = args[1];
|
||||
if (!--noptargs) {
|
||||
goto skip_optional_pos;
|
||||
|
@ -444,9 +438,6 @@ int_from_bytes(PyTypeObject *type, PyObject *const *args, Py_ssize_t nargs, PyOb
|
|||
_PyArg_BadArgument("from_bytes", "argument 'byteorder'", "str", args[1]);
|
||||
goto exit;
|
||||
}
|
||||
if (PyUnicode_READY(args[1]) == -1) {
|
||||
goto exit;
|
||||
}
|
||||
byteorder = args[1];
|
||||
if (!--noptargs) {
|
||||
goto skip_optional_pos;
|
||||
|
@ -484,4 +475,4 @@ int_is_integer(PyObject *self, PyObject *Py_UNUSED(ignored))
|
|||
{
|
||||
return int_is_integer_impl(self);
|
||||
}
|
||||
/*[clinic end generated code: output=cfdf35d916158d4f input=a9049054013a1b77]*/
|
||||
/*[clinic end generated code: output=75ed306fff493ba1 input=a9049054013a1b77]*/
|
||||
|
|
5
Objects/clinic/memoryobject.c.h
generated
5
Objects/clinic/memoryobject.c.h
generated
|
@ -195,9 +195,6 @@ memoryview_cast(PyMemoryViewObject *self, PyObject *const *args, Py_ssize_t narg
|
|||
_PyArg_BadArgument("cast", "argument 'format'", "str", args[0]);
|
||||
goto exit;
|
||||
}
|
||||
if (PyUnicode_READY(args[0]) == -1) {
|
||||
goto exit;
|
||||
}
|
||||
format = args[0];
|
||||
if (!noptargs) {
|
||||
goto skip_optional_pos;
|
||||
|
@ -416,4 +413,4 @@ skip_optional_pos:
|
|||
exit:
|
||||
return return_value;
|
||||
}
|
||||
/*[clinic end generated code: output=01613814112cedd7 input=a9049054013a1b77]*/
|
||||
/*[clinic end generated code: output=a4f6992947bcaf25 input=a9049054013a1b77]*/
|
||||
|
|
5
Objects/clinic/moduleobject.c.h
generated
5
Objects/clinic/moduleobject.c.h
generated
|
@ -63,9 +63,6 @@ module___init__(PyObject *self, PyObject *args, PyObject *kwargs)
|
|||
_PyArg_BadArgument("module", "argument 'name'", "str", fastargs[0]);
|
||||
goto exit;
|
||||
}
|
||||
if (PyUnicode_READY(fastargs[0]) == -1) {
|
||||
goto exit;
|
||||
}
|
||||
name = fastargs[0];
|
||||
if (!noptargs) {
|
||||
goto skip_optional_pos;
|
||||
|
@ -77,4 +74,4 @@ skip_optional_pos:
|
|||
exit:
|
||||
return return_value;
|
||||
}
|
||||
/*[clinic end generated code: output=2f897c9e4721f03f input=a9049054013a1b77]*/
|
||||
/*[clinic end generated code: output=a5a750cc8190576e input=a9049054013a1b77]*/
|
||||
|
|
5
Objects/clinic/typeobject.c.h
generated
5
Objects/clinic/typeobject.c.h
generated
|
@ -224,9 +224,6 @@ object___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 = object___format___impl(self, format_spec);
|
||||
|
||||
|
@ -269,4 +266,4 @@ object___dir__(PyObject *self, PyObject *Py_UNUSED(ignored))
|
|||
{
|
||||
return object___dir___impl(self);
|
||||
}
|
||||
/*[clinic end generated code: output=d2fc52440a89f2fa input=a9049054013a1b77]*/
|
||||
/*[clinic end generated code: output=43533e6981550e9e input=a9049054013a1b77]*/
|
||||
|
|
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