gh-113299: Move Argument Clinic CLI into libclinic by erlend-aasland · Pull Request #115542 · python/cpython · GitHub
Skip to content
9 changes: 5 additions & 4 deletions Lib/test/test_clinic.py
6 changes: 3 additions & 3 deletions Makefile.pre.in
Original file line number Diff line number Diff line change
Expand Up @@ -818,11 +818,11 @@ coverage-report: regen-token regen-frozen
# Run "Argument Clinic" over all source files
.PHONY: clinic
clinic: check-clean-src $(srcdir)/Modules/_blake2/blake2s_impl.c
$(PYTHON_FOR_REGEN) $(srcdir)/Tools/clinic/clinic.py --make --exclude Lib/test/clinic.test.c --srcdir $(srcdir)
$(PYTHON_FOR_REGEN) $(srcdir)/Tools/clinic/run_clinic.py --make --exclude Lib/test/clinic.test.c --srcdir $(srcdir)

.PHONY: clinic-tests
clinic-tests: check-clean-src $(srcdir)/Lib/test/clinic.test.c
$(PYTHON_FOR_REGEN) $(srcdir)/Tools/clinic/clinic.py -f $(srcdir)/Lib/test/clinic.test.c
$(PYTHON_FOR_REGEN) $(srcdir)/Tools/clinic/run_clinic.py -f $(srcdir)/Lib/test/clinic.test.c

# Build the interpreter
$(BUILDPYTHON): Programs/python.o $(LINK_PYTHON_DEPS)
Expand Down Expand Up @@ -850,7 +850,7 @@ pybuilddir.txt: $(PYTHON_FOR_BUILD_DEPS)
# blake2s is auto-generated from blake2b
$(srcdir)/Modules/_blake2/blake2s_impl.c: $(srcdir)/Modules/_blake2/blake2b_impl.c $(srcdir)/Modules/_blake2/blake2b2s.py
$(PYTHON_FOR_REGEN) $(srcdir)/Modules/_blake2/blake2b2s.py
$(PYTHON_FOR_REGEN) $(srcdir)/Tools/clinic/clinic.py -f $@
$(PYTHON_FOR_REGEN) $(srcdir)/Tools/clinic/run_clinic.py -f $@

# Build static library
$(LIBRARY): $(LIBRARY_OBJS)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
The Argument Clinic CLI is now invoked as either :program:`python3
Tools/clinic` or :program:`python3 Tools/clinic/run_clinic.py`, as
:file:`Tools/clinic/clinic.py` has been refactored into ``libclinic``.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The NEWS entry is outdated, there is no __main__.py script.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ohh, thanks; the NEWS entry was not part of the commit I reverted. Good catch.

Comment on lines +1 to +3

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
The Argument Clinic CLI is now invoked as either :program:`python3
Tools/clinic` or :program:`python3 Tools/clinic/run_clinic.py`, as
:file:`Tools/clinic/clinic.py` has been refactored into ``libclinic``.
The Argument Clinic CLI is now invoked as
:program:`python3 Tools/clinic/run_clinic.py`,
since :file:`Tools/clinic/clinic.py` has been refactored into ``libclinic``.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep, I like this NEWS entry.

4 changes: 2 additions & 2 deletions PC/winreg.c
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,7 @@ class HKEY_return_converter(CReturnConverter):
'return_value = PyHKEY_FromHKEY(_PyModule_GetState(module), _return_value);\n')

# HACK: this only works for PyHKEYObjects, nothing else.
# Should this be generalized and enshrined in clinic.py,
# Should this be generalized and enshrined in Argument Clinic,
# destroy this converter with prejudice.
class self_return_converter(CReturnConverter):
type = 'PyHKEYObject *'
Expand All @@ -252,7 +252,7 @@ class self_return_converter(CReturnConverter):
data.return_conversion.append(
'return_value = (PyObject *)_return_value;\n')
[python start generated code]*/
/*[python end generated code: output=da39a3ee5e6b4b0d input=4979f33998ffb6f8]*/
/*[python end generated code: output=da39a3ee5e6b4b0d input=9c01a5ec9b2e88a1]*/

#include "clinic/winreg.c.h"

Expand Down
188 changes: 188 additions & 0 deletions Tools/clinic/libclinic/cli.py
Loading