aboutsummaryrefslogtreecommitdiff
path: root/Tools
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2020-10-09 23:00:45 +0300
committerGitHub <noreply@github.com>2020-10-09 23:00:45 +0300
commit9975cc5008c795e069ce11e2dbed2110cc12e74e (patch)
tree87aca48f943cd04f0a3defe5f2666438efa959fa /Tools
parentbpo-39481: Fix duplicate SimpleQueue type in test_genericalias.py (GH-22619) (diff)
downloadcpython-9975cc5008c795e069ce11e2dbed2110cc12e74e.tar.gz
cpython-9975cc5008c795e069ce11e2dbed2110cc12e74e.tar.bz2
cpython-9975cc5008c795e069ce11e2dbed2110cc12e74e.zip
bpo-41985: Add _PyLong_FileDescriptor_Converter and AC converter for "fildes". (GH-22620)
Diffstat (limited to 'Tools')
-rwxr-xr-xTools/clinic/clinic.py13
1 files changed, 13 insertions, 0 deletions
diff --git a/Tools/clinic/clinic.py b/Tools/clinic/clinic.py
index 1bbbd4f9fb1..5f2eb53e6a0 100755
--- a/Tools/clinic/clinic.py
+++ b/Tools/clinic/clinic.py
@@ -3103,6 +3103,19 @@ class size_t_converter(CConverter):
return super().parse_arg(argname, displayname)
+class fildes_converter(CConverter):
+ type = 'int'
+ converter = '_PyLong_FileDescriptor_Converter'
+
+ def _parse_arg(self, argname, displayname):
+ return """
+ {paramname} = PyObject_AsFileDescriptor({argname});
+ if ({paramname} == -1) {{{{
+ goto exit;
+ }}}}
+ """.format(argname=argname, paramname=self.name)
+
+
class float_converter(CConverter):
type = 'float'
default_type = float