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 <[email protected]>
<http://bugs.python.org/issue16612>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com