summaryrefslogtreecommitdiffstats
path: root/Modules/clinic
Commit message (Collapse)AuthorAgeFilesLines
* 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
* gh-85283: Fix Argument Clinic for md5 extension (#110976)Victor Stinner2023-10-171-2/+2
| | | Limited C API supports the defining class under some conditions.
* gh-85283: Build md5 extension with limited C API (#110967)Victor Stinner2023-10-171-56/+6
| | | | | * Replace _Py_strhex() with few lines of code. * Replace _PyType_GetModuleState() with PyType_GetModuleState(). * Fix make check-c-globals.
* gh-110864: Fix _PyArg_UnpackKeywordsWithVararg overwriting vararg with NULL ↵Nikita Sobolev2023-10-161-1/+71
| | | | (#110868)
* gh-108277: Add os.timerfd_create() function (#108382)Masaru Tsuchiyama2023-10-071-1/+391
| | | | | | | | Add wrapper for timerfd_create, timerfd_settime, and timerfd_gettime to os module. Co-authored-by: Serhiy Storchaka <storchaka@gmail.com> Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com> Co-authored-by: Erlend E. Aasland <erlend.aasland@protonmail.com> Co-authored-by: Victor Stinner <vstinner@python.org>
* gh-82367: Use `FindFirstFile` Win32 API in `ntpath.realpath()` (GH-110298)박문식2023-10-051-1/+39
| | | | | | | * Use `FindFirstFile` Win32 API to fix a bug where `ntpath.realpath()` breaks out of traversing a series of paths where a (handled) `ERROR_ACCESS_DENIED` or `ERROR_SHARING_VIOLATION` occurs. * Update docs to reflect that `ntpath.realpath()` eliminates MS-DOS style names.
* gh-88402: Add new sysconfig variables on Windows (GH-110049)Sam Gross2023-10-041-0/+22
| | | | Co-authored-by: Filipe Laíns <filipe.lains@gmail.com>
* gh-109649: Add os.process_cpu_count() function (#109907)Victor Stinner2023-09-301-5/+3
| | | | | | | | | * Refactor os_sched_getaffinity_impl(): move variable definitions to their first assignment. * Fix test_posix.test_sched_getaffinity(): restore the old CPU mask when the test completes! * Doc: Specify that os.cpu_count() counts *logicial* CPUs. * Doc: Specify that os.sched_getaffinity(0) is related to the calling thread.
* gh-109782: Ensure `os.path.isdir` has the same signature on all platforms ↵Amin Alaee2023-09-281-8/+8
| | | | (GH-109790)
* gh-109723: Disable Py_BUILD_CORE in _testcapi (#109727)Victor Stinner2023-09-221-1/+18
| | | | | | | | | | | | | | | | | | Make sure that the internal C API is not tested by mistake by _testcapi. Undefine Py_BUILD_CORE_BUILTIN and Py_BUILD_CORE_MODULE macros in Modules/_testcapi/parts.h: move code from _testcapimodule.c. heaptype_relative.c and vectorcall_limited.c are using the limited C API which is incompatible with the internal C API. Move test_long_numbits() from _testcapi to _testinternalcapi since it uses the internal C API "pycore_long.h". Fix Modules/_testcapi/pyatomic.c: don't include Python.h directly, just include _testcapi/parts.h. Ajust "make check-c-globals" for these changes.
* gh-108717: Speedup `os.DirEntry.is_junction` function (#108718)Nikita Sobolev2023-09-061-9/+5
|
* gh-106320: Remove private _PyErr_WriteUnraisableMsg() (#108863)Victor Stinner2023-09-041-1/+33
| | | | | | Move the private _PyErr_WriteUnraisableMsg() functions to the internal C API (pycore_pyerrors.h). Move write_unraisable_exc() from _testcapi to _testinternalcapi.
* gh-108494: Argument Clinic: inline parsing code for positional-only ↵Serhiy Storchaka2023-09-031-6/+16
| | | | parameters in the limited C API (GH-108622)
* gh-107603: Argument Clinic: Only include pycore_gc.h if needed (#108726)Victor Stinner2023-08-3165-360/+170
| | | | | | | | | | | | | | | | | | | | 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 support of Limited C API (GH-108536)Serhiy Storchaka2023-08-281-3/+2
|
* gh-106320: Remove private AC converter functions (#108505)Victor Stinner2023-08-2616-16/+32
| | | | | | | | | | | | | | 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-265-5/+10
| | | | | | | | | 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-266-6/+12
| | | | | | | | | | | 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-1/+33
| | | | AC now checks for "#define Py_LIMITED_API" pattern to use the limited C API.
* gh-108494: Argument Clinic partial supports of Limited C API (#108495)Victor Stinner2023-08-251-0/+53
| | | | | | | | | | 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-2432-276/+276
| | | | 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-32/+331
| | | | [from ...]' markers (GH-108132)
* gh-107704: Argument Clinic: add support for deprecating keyword use of ↵Serhiy Storchaka2023-08-192-1140/+2095
| | | | | | | | | | | | 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-107801: Improve the accuracy of os.lseek docs (#107935)Erlend E. Aasland2023-08-181-4/+13
| | | | | | | | - name the last parameter *whence*, like it is for seek() methods on file objects - add param docstrings - structure the valid *whence* params Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
* gh-105481: opcode.h is no longer generated during the build (#108080)Irit Katriel2023-08-171-1/+21
|
* gh-107880: Teach Argument Clinic to clone __init__ and __new__ methods (#107885)Erlend E. Aasland2023-08-131-1/+167
|
* gh-106844: Fix issues in _winapi.LCMapStringEx (GH-107832)Serhiy Storchaka2023-08-111-7/+5
| | | | | | | | | * Strings with length from 2**31-1 to 2**32-2 always caused MemoryError, it doesn't matter how much memory is available. * Strings with length exactly 2**32-1 caused OSError. * Strings longer than 2**32-1 characters were truncated due to integer overflow bug. * Strings containing the null character were truncated at the first null character. Now strings longer than 2**31-1 characters caused OverflowError and the null character is allowed.