[issue16612] Integrate "Argument Clinic" specialized preprocessor into CPython trunk
Serhiy Storchaka
report at bugs.python.org
Sat Feb 16 21:00:02 CET 2013
Serhiy Storchaka added the comment:
> { path: [string, bytes, int] => path_converter => path_t },
> *,
> { dir_fd: [int, None] = None => OS_STAT_DIR_FD_CONVERTER => int },
> { follow_symlinks: bool = True => "p" => int }
Why not just:
path: path_t
*
dir_fd: dir_fd_t = None => DEFAULT_DIR_FD
follow_symlinks: bool = True => 1
?
And register types somewhere:
clinic.register('path_t', restype='path_t', converter='path_converter', signature='[string, bytes, int]')
clinic.register('dir_fd_t', restype='int', converter='OS_STAT_DIR_FD_CONVERTER', signature='[int, None]')
clinic.register('bool', restype='int', converter='_PyBool_Converter', signature='bool')
...
clinic.register('string', restype='PyObject *', converter='_PyUnicode_Converter', signature='string')
clinic.register('buffer', restype='PyBuffer', converter='_PyBuffer_Converter', signature='buffer')
...
clinic.register('int', restype='int', converter='_Py_int_Converter', signature='int')
clinic.register('unsigned long', restype='unsigned long', converter='_Py_long_Converter', signature='int')
If you use path_converter, then definitely input types are [string, bytes, int] and an output C type is path_t. You need only name all converters and register them.
----------
nosy: +serhiy.storchaka
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue16612>
_______________________________________
More information about the Python-bugs-list
mailing list