summaryrefslogtreecommitdiffstats
path: root/Modules/clinic
Commit message (Collapse)AuthorAgeFilesLines
* gh-85283: Build _statistics extension with the limited C API (#116927)Victor Stinner2024-03-171-32/+13
| | | | | Argument Clinic now inlines _PyArg_CheckPositional() for the limited C API. The generated code should be as fast or even a little bit faster.
* gh-85283: Build termios extension with the limited C API (#116928)Victor Stinner2024-03-171-13/+16
|
* gh-73468: Add math.fma() function (#116667)Victor Stinner2024-03-171-1/+62
| | | | | | Added new math.fma() function, wrapping C99's ``fma()`` operation: fused multiply-add function. Co-authored-by: Mark Dickinson <mdickinson@enthought.com>
* gh-85283: Build pwd extension with the limited C API (#116841)Victor Stinner2024-03-151-4/+2
| | | | Argument Clinic now uses the PEP 737 "%T" format to format type name for the limited C API.
* gh-116646, AC: Always use PyObject_AsFileDescriptor() in fildes (#116806)Victor Stinner2024-03-143-38/+67
| | | | | | | The fildes converter of Argument Clinic now always call PyObject_AsFileDescriptor(), not only for the limited C API. The _PyLong_FileDescriptor_Converter() converter stays as a fallback when PyObject_AsFileDescriptor() cannot be used.
* gh-116646, AC: Add CConverter.use_converter() method (#116793)Victor Stinner2024-03-141-2/+1
| | | Only add includes when the converter is effectively used.
* gh-85283: Build fcntl extension with the limited C API (#116791)Victor Stinner2024-03-141-16/+33
|
* gh-116646: Add limited C API support to AC fildes converter (#116769)Victor Stinner2024-03-141-1/+34
| | | Add tests on the "fildes" converter to _testclinic_limited.
* gh-85283: Convert grp extension to the limited C API (#116611)Victor Stinner2024-03-121-75/+11
| | | | posixmodule.h: remove check on the limited C API, since these helpers are not part of the public C API.
* gh-110850: Fix _PyTime_FromSecondsDouble() API (#116606)Victor Stinner2024-03-111-12/+12
| | | | | | | | Return 0 on success. Set an exception and return -1 on error. Fix os.timerfd_settime(): properly report exceptions on _PyTime_FromSecondsDouble() failure. No longer export _PyTime_FromSecondsDouble().
* gh-116417: Avoid PyFloat_AS_DOUBLE() in AC limited C API (#116568)Victor Stinner2024-03-101-1/+83
| | | | Argument Clinic no longer calls PyFloat_AS_DOUBLE() when the usage of the limited C API is requested.
* gh-115398: Expose Expat >=2.6.0 reparse deferral API (CVE-2023-52425) ↵Sebastian Pipping2024-02-292-2/+66
| | | | | | | | | | | | | | | | | | | | | (GH-115623) Allow controlling Expat >=2.6.0 reparse deferral (CVE-2023-52425) by adding five new methods: - `xml.etree.ElementTree.XMLParser.flush` - `xml.etree.ElementTree.XMLPullParser.flush` - `xml.parsers.expat.xmlparser.GetReparseDeferralEnabled` - `xml.parsers.expat.xmlparser.SetReparseDeferralEnabled` - `xml.sax.expatreader.ExpatParser.flush` Based on the "flush" idea from https://github.com/python/cpython/pull/115138#issuecomment-1932444270 . ### Notes - Please treat as a security fix related to CVE-2023-52425. Includes code suggested-by: Snild Dolkow <snild@sony.com> and by core dev Serhiy Storchaka.
* gh-112529: Simplify PyObject_GC_IsTracked and PyObject_GC_IsFinalized (#114732)Sam Gross2024-02-281-1/+39
|
* gh-112050: Make collections.deque thread-safe in free-threaded builds (#113830)mpage2024-02-151-8/+149
| | | | | | | Use critical sections to make deque methods that operate on mutable state thread-safe when the GIL is disabled. This is mostly accomplished by using the @critical_section Argument Clinic directive, though there are a few places where this was not possible and critical sections had to be manually acquired/released.
* gh-89240: Enable multiprocessing on Windows to use large process pools ↵Steve Dower2024-02-131-1/+497
| | | | | | | (GH-107873) We add _winapi.BatchedWaitForMultipleObjects to wait for larger numbers of handles. This is an internal module, hence undocumented, and should be used with caution. Check the docstring for info before using BatchedWaitForMultipleObjects.
* gh-114894: add array.array.clear() method (#114919)Mike Zimin2024-02-101-1/+19
| | | | | Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com> Co-authored-by: AN Long <aisk@users.noreply.github.com> Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
* gh-115015: Argument Clinic: fix generated code for METH_METHOD methods ↵Erlend E. Aasland2024-02-0516-48/+70
| | | | without params (#115016)
* gh-115026: Argument Clinic: handle PyBuffer_FillInfo errors in generated ↵Nikita Sobolev2024-02-052-7/+17
| | | | code (#115027)
* gh-112919: Speed-up datetime, date and time.replace() (GH-112921)Eugene Toder2024-01-301-1/+351
| | | | | Use argument clinic and call new_* functions directly. This speeds up these functions 6x to 7.5x when calling with keyword arguments.
* gh-85984: Add POSIX pseudo-terminal functions. (GH-102413)Soumendra Ganguly2024-01-291-1/+167
| | | | | Signed-off-by: Soumendra Ganguly <soumendraganguly@gmail.com> Co-authored-by: Gregory P. Smith <greg@krypto.org> Co-authored-by: Petr Viktorin <encukou@gmail.com>
* gh-112050: Adapt collections.deque to Argument Clinic (#113963)mpage2024-01-291-1/+417
|
* Use Unicode unconditionally for _winapi.CreateFile (GH-114611)Steve Dower2024-01-261-5/+8
| | | Currently it switches based on build settings, but argument clinic does not handle it correctly.
* gh-113884: Make queue.SimpleQueue thread-safe when the GIL is disabled (#114161)mpage2024-01-231-3/+21
| | | | | | | * use the ParkingLot API to manage waiting threads * use Argument Clinic's critical section directive to protect queue methods * remove unnecessary overflow check Co-authored-by: Erlend E. Aasland <erlend.aasland@protonmail.com>
* gh-89850: Add default C implementations of persistent_id() and ↵Serhiy Storchaka2024-01-101-1/+44
| | | | | | | | | | | persistent_load() (GH-113579) Previously the C implementation of pickle.Pickler and pickle.Unpickler classes did not have such methods and they could only be used if they were overloaded in subclasses or set as instance attributes. Fixed calling super().persistent_id() and super().persistent_load() in subclasses of the C implementation of pickle.Pickler and pickle.Unpickler classes. It no longer causes an infinite recursion.
* gh-113755: Fully adapt gcmodule.c to Argument Clinic (#113756)Erlend E. Aasland2024-01-081-1/+123
| | | | | | | Adapt the following functions to Argument Clinic: - gc.set_threshold - gc.get_referrers - gc.get_referents
* gh-110721: Remove unused code from suggestions.c after moving PyErr_Display ↵Pablo Galindo Salgado2024-01-081-0/+41
| | | | to use the traceback module (#113712)
* gh-113536: Expose `os.waitid` on macOS (#113542)Ronald Oussoren2024-01-011-3/+3
| | | | | | | | | * gh-113536: Expose `os.waitid` on macOS This API has been available on macOS for a long time, but was explicitly excluded due to unspecified problems with the API in ancient versions of macOS. * Document that the API is available on macOS starting in Python 3.13
* gh-113191: Add support of os.fchmod() on Windows (GH-113192)Serhiy Storchaka2023-12-241-3/+3
| | | | Also support a file descriptor in os.chmod().
* gh-113202: Add a strict option to itertools.batched() (gh-113203)Raymond Hettinger2023-12-161-9/+23
|
* gh-59616: Support os.chmod(follow_symlinks=True) and os.lchmod() on Windows ↵Serhiy Storchaka2023-12-141-5/+6
| | | | (GH-113049)
* gh-112730: Use color to highlight error locations (gh-112732)Pablo Galindo Salgado2023-12-061-1/+27
| | | | Signed-off-by: Pablo Galindo <pablogsal@gmail.com> Co-authored-by: Łukasz Langa <lukasz@langa.pl>
* gh-112567: Add _Py_GetTicksPerSecond() function (#112587)Victor Stinner2023-12-011-9/+1
| | | | | | | | | | * Move _PyRuntimeState.time to _posixstate.ticks_per_second and time_module_state.ticks_per_second. * Add time_module_state.clocks_per_second. * Rename _PyTime_GetClockWithInfo() to py_clock(). * Rename _PyTime_GetProcessTimeWithInfo() to py_process_time(). * Add process_time_times() helper function, called by py_process_time(). * os.times() is now always built: no longer rely on HAVE_TIMES.
* gh-112071: Make `_random.Random` methods thread-safe in `--disable-gil` ↵Radislav Chugunov2023-11-281-3/+35
| | | | | | builds (gh-112128) Co-authored-by: Donghee Na <donghee.na@python.org>
* gh-63284: Add support for TLS-PSK (pre-shared key) to the ssl module (#103181)Grant Ramsay2023-11-271-1/+136
| | | | | | | | Add support for TLS-PSK (pre-shared key) to the ssl module. --------- Co-authored-by: Oleg Iarygin <oleg@arhadthedev.net> Co-authored-by: Gregory P. Smith <greg@krypto.org>
* gh-112358: Fix Python 3.12 regression with subclassing struct.Struct. (#112424)Mark Dickinson2023-11-261-8/+8
| | | | | | Revert commit c8c0afc7137ab9f22bf59d591084948ca967c97c (PR #94532), which moved `struct.Struct` initialisation from `Struct.__init__` to `Struct.__new__`. This caused issues with code in the wild that subclasses `struct.Struct`.
* gh-112213: Update _weakref module to use new AC feature (gh-112250)Donghee Na2023-11-191-1/+19
|
* gh-111903: Update AC to support "pycore_critical_section.h" header (gh-112251)Donghee Na2023-11-191-1/+2
|
* gh-112070: make `functools.lru_cache` threadsafe in --disable-gil build ↵Wanderxjtu2023-11-171-3/+15
| | | | | | | | | | | | | | | | | (gh-112111) * gh-112070: make `functools.lrucacle` threadsafe in --disable-gil build * gh-112070: update generate `functoolsmodule` files * gh-112070: add NEWS file * Delete Misc/NEWS.d/next/Library/2023-11-15-20-19-45.gh-issue-112070.q6OhcU.rst * gh-112070: reformat functoolsmodule.c --------- Co-authored-by: Sam Gross <colesbury@gmail.com>
* gh-111916: Make hashlib related modules thread-safe without the GIL (#111981)Tomas R2023-11-151-7/+58
| | | | | Always use an individual lock on hash objects when in free-threaded builds. Fixes #111916
* GH-111804: Drop posix.fallocate() under WASI (GH-111869)Brett Cannon2023-11-091-3/+3
| | | | | | | Drop posix.fallocate() under WASI. The underlying POSIX function, posix_fallocate(), was found to vary too much between implementations to remain in WASI. As such, while it was available in WASI preview1, it's been dropped in preview2.
* socket: Update generated AC code (#111853)Jelle Zijlstra2023-11-081-2/+7
|
* gh-111662: Update socket module to use AC for optimizing performance (gh-111661)Bogdan Romanyuk2023-11-081-1/+164
|
* gh-111089: Revert PyUnicode_AsUTF8() changes (#111833)Victor Stinner2023-11-0714-111/+596
| | | | | | | | | | | | | | | | | | | | | * Revert "gh-111089: Use PyUnicode_AsUTF8() in Argument Clinic (#111585)" This reverts commit d9b606b3d04fc56fb0bcc479d7d6c14562edb5e2. * Revert "gh-111089: Use PyUnicode_AsUTF8() in getargs.c (#111620)" This reverts commit cde1071b2a72e8261ca66053ef61431b7f3a81fd. * Revert "gh-111089: PyUnicode_AsUTF8() now raises on embedded NUL (#111091)" This reverts commit d731579bfb9a497cfb0076cb6b221058a20088fe. * Revert "gh-111089: Add PyUnicode_AsUTF8() to the limited C API (#111121)" This reverts commit d8f32be5b6a736dc2fc9dca3f1bf176c82fc9b44. * Revert "gh-111089: Use PyUnicode_AsUTF8() in sqlite3 (#111122)" This reverts commit 37e4e20eaa8f27ada926d49e5971fecf0477ad26.
* gh-108082: Remove _PyErr_WriteUnraisableMsg() (GH-111643)Serhiy Storchaka2023-11-031-33/+1
| | | | Replace the remaining calls with PyErr_FormatUnraisable().
* gh-111482: Use Argument Clinic for clock_gettime() (#111641)Victor Stinner2023-11-021-0/+74
| | | | | | | | | | | | | | | | | | Use Argument Clinic for time.clock_gettime() and time.clock_gettime_ns() functions. Benchmark on time.clock_gettime_ns(): import time import pyperf runner = pyperf.Runner() runner.timeit( 'clock_gettime_ns(CLOCK_MONOTONIC_COARSE)', setup='import time; clock_gettime_ns=time.clock_gettime_ns; CLOCK_MONOTONIC_COARSE=6', stmt='clock_gettime_ns(CLOCK_MONOTONIC_COARSE)') Result on Linux with CPU isolation: Mean +- std dev: [ref] 134 ns +- 1 ns -> [change] 55.7 ns +- 1.4 ns: 2.41x faster
* gh-111089: Use PyUnicode_AsUTF8() in Argument Clinic (#111585)Victor Stinner2023-11-0114-596/+111
| | | | | | | Replace PyUnicode_AsUTF8AndSize() with PyUnicode_AsUTF8() to remove the explicit check for embedded null characters. The change avoids to have to include explicitly <string.h> to get the strlen() function when using a recent version of the limited C API.
* gh-67565: Remove redundant C-contiguity checks (GH-105521)Furkan Onder2023-10-2311-271/+11
| | | | Co-authored-by: Stefan Krah <skrah@bytereef.org>
* gh-110093: Replace trivial Py_BuildValue() with direct C API call (GH-110094)Serhiy Storchaka2023-10-202-7/+12
|
* gh-85283: Build resource extension with limited C API (#110989)Victor Stinner2023-10-171-7/+11
| | | | | | * Replace PyStructSequence_SET_ITEM() with PyStructSequence_SetItem(). * Replace PyTuple_GET_SIZE() with PyTuple_Size(). * Replace PyTuple_GET_ITEM() with PyTuple_GetItem().
* gh-110964: Remove private _PyArg functions (#110966)Victor Stinner2023-10-1761-61/+140
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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