Skip to content

gh-155212: List the converters defined in a C file - #155221

Merged
serhiy-storchaka merged 2 commits into
python:mainfrom
serhiy-storchaka:clinic-converters-list
Aug 5, 2026
Merged

gh-155212: List the converters defined in a C file#155221
serhiy-storchaka merged 2 commits into
python:mainfrom
serhiy-storchaka:clinic-converters-list

Conversation

@serhiy-storchaka

@serhiy-storchaka serhiy-storchaka commented Aug 5, 2026

Copy link
Copy Markdown
Member

--converters now accepts file names and can be used with --make.
It parses the specified files, without writing anything, and prints the converters and return converters which they define, instead of the built-in ones.

$ ./python Tools/clinic/clinic.py --converters Modules/posixmodule.c

Legacy converters:
    " _Py_PARSE_INTPTR " " _Py_PARSE_PID "

Converters:
    confname(table)
    dev_t()
    dir_fd()
    ...
    path_t(allow_fd=False, make_wide=None, nonstrict=False, nullable=False, suppress_value_error=False)

Return converters:
    dev_t()

Two other changes:

  • Legacy converters whose format unit does not start with a letter, like those defined in Modules/posixmodule.c, were silently omitted from the list.
  • A directory passed as a file name raised IsADirectoryError instead of reporting an error, in every mode.

The --converters option now accepts file names and can be used with
--make.  It parses the specified files, without writing anything, and
prints the converters and return converters which they define, instead
of the built-in ones.

Legacy converters whose format unit does not start with a letter, like
those defined in Modules/posixmodule.c, were silently omitted from the
list; they are now printed on a separate line.

A directory passed as a file name raised IsADirectoryError instead of
reporting an error, in every mode.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Opening a directory fails with IsADirectoryError on Unix, but with
PermissionError on Windows.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@serhiy-storchaka
serhiy-storchaka merged commit 2d9a693 into python:main Aug 5, 2026
59 checks passed
@serhiy-storchaka
serhiy-storchaka deleted the clinic-converters-list branch August 5, 2026 09:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant