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:
Victor Stinner 2023-06-02 01:31:58 +02:00 committed by GitHub
parent 146939306a
commit cbb9ba844f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
35 changed files with 37 additions and 321 deletions

View file

@ -193,9 +193,6 @@ warnings_warn_explicit(PyObject *module, PyObject *const *args, Py_ssize_t nargs
_PyArg_BadArgument("warn_explicit", "argument 'filename'", "str", args[2]);
goto exit;
}
if (PyUnicode_READY(args[2]) == -1) {
goto exit;
}
filename = args[2];
lineno = _PyLong_AsInt(args[3]);
if (lineno == -1 && PyErr_Occurred()) {
@ -246,4 +243,4 @@ warnings_filters_mutated(PyObject *module, PyObject *Py_UNUSED(ignored))
{
return warnings_filters_mutated_impl(module);
}
/*[clinic end generated code: output=20429719d7223bdc input=a9049054013a1b77]*/
/*[clinic end generated code: output=f8d67e0f75771c36 input=a9049054013a1b77]*/

View file

@ -216,9 +216,6 @@ builtin_format(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
_PyArg_BadArgument("format", "argument 2", "str", args[1]);
goto exit;
}
if (PyUnicode_READY(args[1]) == -1) {
goto exit;
}
format_spec = args[1];
skip_optional:
return_value = builtin_format_impl(module, value, format_spec);
@ -1409,4 +1406,4 @@ builtin_issubclass(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
exit:
return return_value;
}
/*[clinic end generated code: output=84a04e7446debf58 input=a9049054013a1b77]*/
/*[clinic end generated code: output=ef2f16ece134d62d input=a9049054013a1b77]*/

View file

@ -106,9 +106,6 @@ _imp__fix_co_filename(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
_PyArg_BadArgument("_fix_co_filename", "argument 2", "str", args[1]);
goto exit;
}
if (PyUnicode_READY(args[1]) == -1) {
goto exit;
}
path = args[1];
return_value = _imp__fix_co_filename_impl(module, code, path);
@ -165,9 +162,6 @@ _imp_init_frozen(PyObject *module, PyObject *arg)
_PyArg_BadArgument("init_frozen", "argument", "str", arg);
goto exit;
}
if (PyUnicode_READY(arg) == -1) {
goto exit;
}
name = arg;
return_value = _imp_init_frozen_impl(module, name);
@ -237,9 +231,6 @@ _imp_find_frozen(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyOb
_PyArg_BadArgument("find_frozen", "argument 1", "str", args[0]);
goto exit;
}
if (PyUnicode_READY(args[0]) == -1) {
goto exit;
}
name = args[0];
if (!noptargs) {
goto skip_optional_kwonly;
@ -282,9 +273,6 @@ _imp_get_frozen_object(PyObject *module, PyObject *const *args, Py_ssize_t nargs
_PyArg_BadArgument("get_frozen_object", "argument 1", "str", args[0]);
goto exit;
}
if (PyUnicode_READY(args[0]) == -1) {
goto exit;
}
name = args[0];
if (nargs < 2) {
goto skip_optional;
@ -319,9 +307,6 @@ _imp_is_frozen_package(PyObject *module, PyObject *arg)
_PyArg_BadArgument("is_frozen_package", "argument", "str", arg);
goto exit;
}
if (PyUnicode_READY(arg) == -1) {
goto exit;
}
name = arg;
return_value = _imp_is_frozen_package_impl(module, name);
@ -351,9 +336,6 @@ _imp_is_builtin(PyObject *module, PyObject *arg)
_PyArg_BadArgument("is_builtin", "argument", "str", arg);
goto exit;
}
if (PyUnicode_READY(arg) == -1) {
goto exit;
}
name = arg;
return_value = _imp_is_builtin_impl(module, name);
@ -383,9 +365,6 @@ _imp_is_frozen(PyObject *module, PyObject *arg)
_PyArg_BadArgument("is_frozen", "argument", "str", arg);
goto exit;
}
if (PyUnicode_READY(arg) == -1) {
goto exit;
}
name = arg;
return_value = _imp_is_frozen_impl(module, name);
@ -648,4 +627,4 @@ exit:
#ifndef _IMP_EXEC_DYNAMIC_METHODDEF
#define _IMP_EXEC_DYNAMIC_METHODDEF
#endif /* !defined(_IMP_EXEC_DYNAMIC_METHODDEF) */
/*[clinic end generated code: output=b18d46e0036eff49 input=a9049054013a1b77]*/
/*[clinic end generated code: output=a95ec234672280a2 input=a9049054013a1b77]*/

View file

@ -282,9 +282,6 @@ sys_intern(PyObject *module, PyObject *arg)
_PyArg_BadArgument("intern", "argument", "str", arg);
goto exit;
}
if (PyUnicode_READY(arg) == -1) {
goto exit;
}
s = arg;
return_value = sys_intern_impl(module, s);
@ -1415,4 +1412,4 @@ exit:
#ifndef SYS_GETANDROIDAPILEVEL_METHODDEF
#define SYS_GETANDROIDAPILEVEL_METHODDEF
#endif /* !defined(SYS_GETANDROIDAPILEVEL_METHODDEF) */
/*[clinic end generated code: output=6d598acc26237fbe input=a9049054013a1b77]*/
/*[clinic end generated code: output=41937e0843c68009 input=a9049054013a1b77]*/