summaryrefslogtreecommitdiffstats
path: root/Tools/clinic
Commit message (Collapse)AuthorAgeFilesLines
* gh-67565: Remove redundant C-contiguity checks (GH-105521)Furkan Onder2023-10-231-12/+1
| | | | Co-authored-by: Stefan Krah <skrah@bytereef.org>
* gh-110964: clinic: refactor output_templates() (#110982)Victor Stinner2023-10-201-56/+53
|
* gh-110964: Remove private _PyArg functions (#110966)Victor Stinner2023-10-171-0/+22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Move the following private functions and structures to pycore_modsupport.h internal C API: * _PyArg_BadArgument() * _PyArg_CheckPositional() * _PyArg_NoKeywords() * _PyArg_NoPositional() * _PyArg_ParseStack() * _PyArg_ParseStackAndKeywords() * _PyArg_Parser structure * _PyArg_UnpackKeywords() * _PyArg_UnpackKeywordsWithVararg() * _PyArg_UnpackStack() * _Py_ANY_VARARGS() Changes: * Python/getargs.h now includes pycore_modsupport.h to export functions. * clinic.py now adds pycore_modsupport.h when one of these functions is used. * Add pycore_modsupport.h includes when a C extension uses one of these functions. * Define Py_BUILD_CORE_MODULE in C extensions which now include directly or indirectly (via code generated by Argument Clinic) pycore_modsupport.h: * _csv * _curses_panel * _dbm * _gdbm * _multiprocessing.posixshmem * _sqlite.row * _statistics * grp * resource * syslog * _testcapi: bad_get() no longer uses METH_FASTCALL calling convention but METH_VARARGS. Replace _PyArg_UnpackStack() with PyArg_ParseTuple(). * _testcapi: add PYTESTCAPI_NEED_INTERNAL_API macro which is defined by _testcapi sub-modules which need the internal C API (pycore_modsupport.h): exceptions.c, float.c, vectorcall.c, watchers.c. * Remove Include/cpython/modsupport.h header file. Include/modsupport.h no longer includes the removed header file. * Fix mypy clinic.py
* gh-85283: Fix Argument Clinic for md5 extension (#110976)Victor Stinner2023-10-171-3/+2
| | | Limited C API supports the defining class under some conditions.
* gh-110907: AC: Disallow using `*` with vararg (#110908)Nikita Sobolev2023-10-161-0/+9
|
* gh-110558: Enable ruff's pyupgrade rules when running on Argument Clinic ↵Alex Waygood2023-10-102-1/+16
| | | | (#110603)
* gh-110558: Run ruff on Argument Clinic in CI (#110559)Alex Waygood2023-10-102-3/+14
|
* gh-108494: Argument Clinic: inline parsing code for positional-only ↵Serhiy Storchaka2023-09-031-254/+489
| | | | parameters in the limited C API (GH-108622)
* gh-107603: Argument Clinic: Only include pycore_gc.h if needed (#108726)Victor Stinner2023-08-311-37/+104
| | | | | | | | | | | | | | | | | | | | Argument Clinic now only includes pycore_gc.h if PyGC_Head is needed, and only includes pycore_runtime.h if _Py_ID() is needed. * Add 'condition' optional argument to Clinic.add_include(). * deprecate_keyword_use() includes pycore_runtime.h when using the _PyID() function. * Fix rendering of includes: comments start at the column 35. * Mark PC/clinic/_wmimodule.cpp.h and "Objects/stringlib/clinic/*.h.h" header files as generated in .gitattributes. Effects: * 42 header files generated by AC no longer include the internal C API, instead of 4 header files before. For example, Modules/clinic/_abc.c.h no longer includes the internal C API. * Fix _testclinic_depr.c.h: it now always includes pycore_runtime.h to get _Py_ID().
* gh-108494: Argument Clinic: fix option group for Limited C API (#108574)Victor Stinner2023-08-291-3/+9
| | | Use PyTuple_Size() instead of PyTuple_GET_SIZE().
* GH-107603: Clinic: Pass specific attributes to ``print_block()`` (#108581)Adam Turner2023-08-281-11/+17
|
* gh-108494: Argument clinic: Improve the `parse_file()` API (#108575)Alex Waygood2023-08-281-7/+7
| | | Co-authored-by: Victor Stinner <vstinner@python.org>
* gh-108494: Argument Clinic: fix support of Limited C API (GH-108536)Serhiy Storchaka2023-08-281-97/+124
|
* gh-104683: Argument Clinic: Refactor the module and class resolver (#108552)Erlend E. Aasland2023-08-281-16/+10
|
* gh-106320: Remove private AC converter functions (#108505)Victor Stinner2023-08-261-0/+3
| | | | | | | | | | | | | | Move these private functions to the internal C API (pycore_abstract.h): * _Py_convert_optional_to_ssize_t() * _PyNumber_Index() Argument Clinic now emits #include "pycore_abstract.h" when these functions are used. The parser of the c-analyzer tool now uses a list of files which use the limited C API, rather than a list of files using the internal C API.
* gh-106320: Remove private _PyLong_FileDescriptor_Converter() (#108503)Victor Stinner2023-08-261-0/+8
| | | | | | | | | Move the private _PyLong converter functions to the internal C API * _PyLong_FileDescriptor_Converter(): moved to pycore_fileutils.h * _PyLong_Size_t_Converter(): moved to pycore_long.h Argument Clinic now emits includes for pycore_fileutils.h and pycore_long.h when these functions are used.
* gh-106320: Remove private _PyLong converter functions (#108499)Victor Stinner2023-08-261-0/+8
| | | | | | | | | | | Move these private functions to the internal C API (pycore_long.h): * _PyLong_UnsignedInt_Converter() * _PyLong_UnsignedLongLong_Converter() * _PyLong_UnsignedLong_Converter() * _PyLong_UnsignedShort_Converter() Argument Clinic now emits #include "pycore_long.h" when these functions are used.
* gh-108494: AC supports pos-only args in limited C API (#108498)Victor Stinner2023-08-251-4/+20
| | | | AC now checks for "#define Py_LIMITED_API" pattern to use the limited C API.
* gh-107603: Argument Clinic can emit includes (#108486)Victor Stinner2023-08-251-17/+41
| | | | | | * Add Clinic.add_include() method * Add CConverter.include and CConverter.add_include() * Printer.print_block() gets a second parameter: clinic. * Remove duplicated declaration of "clinic" global variable.
* gh-108494: Argument Clinic partial supports of Limited C API (#108495)Victor Stinner2023-08-251-11/+44
| | | | | | | | | | Argument Clinic now has a partial support of the Limited API: * Add --limited option to clinic.c. * Add '_testclinic_limited' extension which is built with the limited C API version 3.13. * For now, hardcode in clinic.py that "_testclinic_limited.c" targets the limited C API.
* gh-108444: Argument Clinic uses PyLong_AsInt() (#108458)Victor Stinner2023-08-241-2/+2
| | | | Argument Clinic now uses the new public PyLong_AsInt(), rather than the old name _PyLong_AsInt().
* gh-95065, gh-107704: Argument Clinic: support multiple '/ [from ...]' and '* ↵Serhiy Storchaka2023-08-211-51/+59
| | | | [from ...]' markers (GH-108132)
* gh-107704: Argument Clinic: add support for deprecating keyword use of ↵Serhiy Storchaka2023-08-191-102/+230
| | | | | | | | | | | | parameters (GH-107984) It is now possible to deprecate passing keyword arguments for keyword-or-positional parameters with Argument Clinic, using the new '/ [from X.Y]' syntax. (To be read as "positional-only from Python version X.Y") Co-authored-by: Erlend E. Aasland <erlend@python.org> Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
* gh-104504: Run mypy on cases_generator in CI (and blacken the code) (gh-108090)Dong-hee Na2023-08-181-2/+0
| | | Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
* gh-104683: Argument Clinic: Remove unreachable code from _module_and_class() ↵Erlend E. Aasland2023-08-171-2/+0
| | | | | | | (#108092) 'not hasattr(parent, "classes")' is always false, since 'parent' is an instance of either the Module, Class, or Clinic classes, and all of them has a "classes" attribute.
* gh-104683: Argument Clinic: Extract parse function name helper (#107964)Erlend E. Aasland2023-08-161-32/+29
| | | Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
* gh-107972: Argument Clinic: Ensure a C basename is provided after 'as' (#107973)Erlend E. Aasland2023-08-151-3/+6
| | | Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
* gh-107880: Argument Clinic: Fix regression in gh-107885 (#107974)Erlend E. Aasland2023-08-151-14/+19
| | | Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
* gh-107880: Teach Argument Clinic to clone __init__ and __new__ methods (#107885)Erlend E. Aasland2023-08-131-7/+19
|
* gh-107883: Argument Clinic: Handle full module/class path in ↵Erlend E. Aasland2023-08-121-3/+10
| | | | | Function.fulldisplayname (#107884) Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
* gh-95065: Produce nicer deprecation messages in Argument Clinic (#107808)Erlend E. Aasland2023-08-091-17/+19
|
* gh-104683: Argument Clinic: Params now render their own docstrings (#107790)Erlend E. Aasland2023-08-091-16/+11
| | | Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
* gh-104683: Remove unused variables from `Tools/clinic` and tests for ↵Alex Waygood2023-08-091-1/+1
| | | | `Tools/clinic` (#107771)
* gh-80282: Argument Clinic: Add clarifying comment about ASCII docstring ↵Erlend E. Aasland2023-08-091-0/+5
| | | | | limitation (#107764) Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
* gh-104683: Argument Clinic: refactor format_docstring() (#107623)Erlend E. Aasland2023-08-081-46/+36
| | | | | | | Extract helper methods for formatting the signature and parameter sections, and clean up the remaining function body. Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com> Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
* gh-104683: Add --exclude option to Argument Clinic CLI (#107770)Erlend E. Aasland2023-08-081-0/+11
| | | Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
* gh-106368: Argument clinic: add tests for more failure paths (#107731)Alex Waygood2023-08-081-2/+3
|
* gh-95065: Argument Clinic: Add comment to preprocessor warning code (#107766)Erlend E. Aasland2023-08-081-0/+1
|
* gh-95065: Make Argument Clinic append deprecation warnings to docstrings ↵Erlend E. Aasland2023-08-081-0/+6
| | | | (#107745)
* gh-86457: Fix signature for code.replace() (GH-23199)Serhiy Storchaka2023-08-071-124/+133
| | | | Also add support of @text_signature in Argument Clinic.
* gh-95065: Argument Clinic: Pretty-print long C strings in generated code ↵Erlend E. Aasland2023-08-071-7/+30
| | | | | (#107712) Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
* gh-107713: Reduce usage of mocks in `test_clinic.py` (#107714)Alex Waygood2023-08-071-0/+3
|
* gh-95065: Add Argument Clinic support for deprecating positional use of ↵Erlend E. Aasland2023-08-071-13/+154
| | | | | | | | | | parameters (#95151) It is now possible to deprecate passing parameters positionally with Argument Clinic, using the new '* [from X.Y]' syntax. (To be read as "keyword-only from Python version X.Y") Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com> Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
* gh-106368: Improve coverage reports for argument clinic (#107693)Alex Waygood2023-08-062-6/+15
|
* gh-104683: Improve consistency and test coverage of argument-clinic ↵Alex Waygood2023-08-052-10/+17
| | | | `__repr__` functions (#107667)
* gh-106368: Argument clinic: improve coverage for `self.valid_line()` calls ↵Alex Waygood2023-08-041-3/+1
| | | | (#107641)
* gh-104683: Argument Clinic: Use CConverter.length_name where possible (#107638)Erlend E. Aasland2023-08-041-15/+15
| | | | | Also make it a cached property. Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
* gh-104146: Argument clinic: remove dead code highlighted by the `vulture` ↵Alex Waygood2023-08-041-15/+11
| | | | tool (#107632)
* gh-104146: Argument clinic: Remove dead code flagged by mypy's `truthy-bool` ↵Alex Waygood2023-08-042-7/+3
| | | | check (#107627)
* gh-107614: Normalise Argument Clinic error messages (#107615)Erlend E. Aasland2023-08-041-76/+108
| | | | | | | | - always wrap the offending line, token, or name in quotes - in most cases, put the entire error message on one line Added tests for uncovered branches that were touched by this PR. Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>