Modules/posixmodule.c
defines a custom pid_t converter:
class pid_t_converter(CConverter):
type = 'pid_t'
format_unit = '" _Py_PARSE_PID "'
However, when I copy it into another file (let it be 1.c
):
/*[clinic input] class pid_t_converter(CConverter): type = 'pid_t' format_unit = '" _Py_PARSE_PID "' [clinic start generated code]*/
, clinic throws an exception:
C:\Users\oleg\Documents\dev\notmine\cpython>python Tools\clinic\clinic.py 1.c
Error in file “1.c” on line 7:
DSLParser.directive_class() missing 2 required positional arguments: ‘typedef’ and ‘type_object’
I’ve got three questions:
-
What do I need to add/fix to make it accepted by the tool?
-
How to get a full stack trace (because there must be at least
main()
andparse_file()
in a bottom of the stack)? -
How this method is used? There’s no literal
directive_class
inside CPython codebase:C:\Users\oleg\Documents\dev\notmine\cpython>git grep directive_class Tools/clinic/clinic.py: def directive_class(self, name, typedef, type_object):