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

@ -3266,9 +3266,6 @@ class int_converter(CConverter):
_PyArg_BadArgument("{{name}}", {displayname}, "a unicode character", {argname});
goto exit;
}}}}
if (PyUnicode_READY({argname})) {{{{
goto exit;
}}}}
if (PyUnicode_GET_LENGTH({argname}) != 1) {{{{
_PyArg_BadArgument("{{name}}", {displayname}, "a unicode character", {argname});
goto exit;
@ -3730,9 +3727,6 @@ class unicode_converter(CConverter):
_PyArg_BadArgument("{{name}}", {displayname}, "str", {argname});
goto exit;
}}}}
if (PyUnicode_READY({argname}) == -1) {{{{
goto exit;
}}}}
{paramname} = {argname};
""".format(argname=argname, paramname=self.parser_name,
displayname=displayname)
@ -5528,7 +5522,8 @@ For more information see https://docs.python.org/3/howto/clinic.html""")
if rcs_dir in dirs:
dirs.remove(rcs_dir)
for filename in files:
if not (filename.endswith('.c') or filename.endswith('.h')):
# handle .c, .cpp and .h files
if not filename.endswith(('.c', '.cpp', '.h')):
continue
path = os.path.join(root, filename)
if ns.verbose: