diff options
author | Victor Stinner <vstinner@python.org> | 2024-03-14 13:58:07 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-03-14 13:58:07 (GMT) |
commit | a76288ad9ba715216a29c89e046846b3eaf0fab7 (patch) | |
tree | 33ec622c1df7a0703e0e14b0971ba218883ab12b /Tools | |
parent | 2a54c4b25e05e30c50b915302fa846dd0d4e018b (diff) | |
download | cpython-a76288ad9ba715216a29c89e046846b3eaf0fab7.zip cpython-a76288ad9ba715216a29c89e046846b3eaf0fab7.tar.gz cpython-a76288ad9ba715216a29c89e046846b3eaf0fab7.tar.bz2 |
gh-116646, AC: Always use PyObject_AsFileDescriptor() in fildes (#116806)
The fildes converter of Argument Clinic now always call
PyObject_AsFileDescriptor(), not only for the limited C API.
The _PyLong_FileDescriptor_Converter() converter stays as a fallback
when PyObject_AsFileDescriptor() cannot be used.
Diffstat (limited to 'Tools')
-rwxr-xr-x | Tools/clinic/clinic.py | 17 |
1 files changed, 7 insertions, 10 deletions
diff --git a/Tools/clinic/clinic.py b/Tools/clinic/clinic.py index 21ec6cf..fb56bd2 100755 --- a/Tools/clinic/clinic.py +++ b/Tools/clinic/clinic.py @@ -3832,16 +3832,13 @@ class fildes_converter(CConverter): '_PyLong_FileDescriptor_Converter()') def parse_arg(self, argname: str, displayname: str, *, limited_capi: bool) -> str | None: - if limited_capi: - return self.format_code(""" - {paramname} = PyObject_AsFileDescriptor({argname}); - if ({paramname} < 0) {{{{ - goto exit; - }}}} - """, - argname=argname) - else: - return super().parse_arg(argname, displayname, limited_capi=limited_capi) + return self.format_code(""" + {paramname} = PyObject_AsFileDescriptor({argname}); + if ({paramname} < 0) {{{{ + goto exit; + }}}} + """, + argname=argname) class float_converter(CConverter): |