summaryrefslogtreecommitdiffstats
path: root/Modules/clinic
Commit message (Collapse)AuthorAgeFilesLines
* gh-127614: Correctly check for ttyname_r() in configure (#128503)Erlend E. Aasland2025-01-071-3/+3
| | | | PR #14868 replaced the ttyname() call with ttyname_r(), but the old check remained.
* gh-128002: fix many thread safety issues in asyncio (#128147)Kumar Aditya2025-01-041-14/+536
| | | | | | * Makes `_asyncio.Task` and `_asyncio.Future` thread-safe by adding critical sections * Add assertions to check for thread safety checking locking of object by critical sections in internal functions * Make `_asyncio.all_tasks` thread safe when eager tasks are used * Add a thread safety test
* gh-128277: remove unnecessary critical section from `socket.close` (#128305)Kumar Aditya2025-01-011-9/+2
| | | Remove unnecessary critical section from `socket.close` as it now uses relaxed atomics for `sock_fd`.
* gh-128083: Fix macro redefinition warning in clinic. (GH-127950)Peter Bierma2024-12-191-1/+49
|
* gh-59705: Add _thread.set_name() function (#127338)Victor Stinner2024-12-061-0/+104
| | | | | | | | | | | On Linux, threading.Thread now sets the thread name to the operating system. * configure now checks if pthread_getname_np() and pthread_setname_np() functions are available. * Add PYTHREAD_NAME_MAXLEN macro. * Add _thread._NAME_MAXLEN constant for test_threading. Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
* gh-127627: Add `posix._emscripten_debugger` function (#127628)Hood Chatham2024-12-061-1/+27
| | | Add a posix._emscripten_debugger function to add an emscripten breakpoint.
* gh-126890: Restore stripped `ssl` docstrings (GH-127281)Peter Bierma2024-12-021-1/+64
|
* gh-127341: Argument Clinic: fix compiler warnings for getters with ↵Peter Bierma2024-11-291-112/+40
| | | | | docstrings (#127310) Co-authored-by: Erlend E. Aasland <erlend@python.org>
* gh-126316: Make grp.getgrall() thread-safe: add a mutex (#127055)Victor Stinner2024-11-211-11/+77
| | | | grpmodule.c is no longer built with the limited C API, since PyMutex is excluded from the limited C API.
* gh-118201: Simplify conv_confname (#126089)Malcolm Smith2024-11-191-5/+5
|
* gh-125916: Allow functools.reduce() 'initial' to be a keyword argument (#125917)Sayandip Dutta2024-11-121-8/+37
|
* gh-122943: Add the varpos parameter in _PyArg_UnpackKeywords (GH-126564)Serhiy Storchaka2024-11-0844-392/+740
| | | | Remove _PyArg_UnpackKeywordsWithVararg. Add comments for integer arguments of _PyArg_UnpackKeywords.
* gh-122943: Rework support of var-positional parameter in Argument Clinic ↵Serhiy Storchaka2024-11-074-131/+731
| | | | | | | | | | | | | | | | | | (GH-122945) Move creation of a tuple for var-positional parameter out of _PyArg_UnpackKeywordsWithVararg(). Merge _PyArg_UnpackKeywordsWithVararg() with _PyArg_UnpackKeywords(). Add a new parameter in _PyArg_UnpackKeywords(). The "parameters" and "converters" attributes of ParseArgsCodeGen no longer contain the var-positional parameter. It is now available as the "varpos" attribute. Optimize code generation for var-positional parameter and reuse the same generating code for functions with and without keyword parameters. Add special converters for var-positional parameter. "tuple" represents it as a Python tuple and "array" represents it as a continuous array of PyObject*. "object" is a temporary alias of "tuple".
* gh-119793: Prefer `map(..., strict=True)` over starmap/zip in examples (#126407)Lukas Geiger2024-11-051-2/+2
|
* gh-126220: Adapt `_lsprof` to Argument Clinic (#126233)sobolevn2024-11-041-1/+361
| | | Co-authored-by: Erlend E. Aasland <erlend.aasland@protonmail.com>
* gh-125916: Adapt functools.reduce() to Argument Clinic (#125999)Sergey B Kirpichev2024-11-011-1/+45
|
* gh-101123: Adapt vararg functions in the math module to Argument Clinic ↵Sergey B Kirpichev2024-10-311-1/+99
| | | | | | (#126235) This implicitly fixes the math.hypot signature, which was previously incomprehensible to inspect.signature().
* gh-90370: Argument Clinic: avoid temporary tuple creation for varargs (#126064)Sergey B Kirpichev2024-10-312-57/+30
| | | | | | | Avoid temporary tuple creation when all arguments either positional-only or vararg. Objects/setobject.c and Modules/gcmodule.c adapted. This fixes slight performance regression for set methods, introduced by gh-115112.
* gh-94512: Fix forced arg format in posixmodule.c clinic code (#122516)Bénédikt Tran2024-10-261-38/+154
|
* gh-124984: Enhance `ssl` thread safety (#124993)Peter Bierma2024-10-191-18/+1183
| | | | | | Make SSL objects thread safe in Free Theaded build by using critical sections. Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
* gh-125243: Fix ZoneInfo data race in free threading build (#125281)Sam Gross2024-10-131-1/+60
| | | | | | | | Lock `ZoneInfoType` to protect accesses to `ZONEINFO_STRONG_CACHE`. Refactor the `tp_new` handler to use Argument Clinic so that we can just use `@critical_section` annotations on the relevant functions. Also use `PyDict_SetDefaultRef` instead of `PyDict_SetDefault` when inserting into the `TIMEDELTA_CACHE`.
* gh-124917: Allow keyword args to os.path.exists/lexists on Windows (#124918)Jelle Zijlstra2024-10-111-9/+69
|
* gh-123961: Convert `curses.window` static type into a heap type (#124934)Bénédikt Tran2024-10-041-5/+5
|
* gh-120378: Fix crash caused by integer overflow in `curses` (#124555)Peter Bierma2024-10-021-19/+79
| | | | | | | | | This is actually an upstream problem in curses, and has been reported to them already: https://lists.gnu.org/archive/html/bug-ncurses/2024-09/msg00101.html This is a nice workaround in the meantime to prevent the segfault. Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
* gh-124665: Add `_PyCodec_UnregisterError` and `_codecs._unregister_error` ↵Bénédikt Tran2024-09-291-1/+51
| | | | (#124677)
* gh-123014: Disable pidfd API on older Android versions (#124458)Malcolm Smith2024-09-252-6/+6
|
* gh-102511: Change the `os.path.splitroot` param name from `path` back to `p` ↵sobolevn2024-09-181-4/+4
| | | | (GH-124097)
* gh-99108: Add HACL* Blake2 implementation to hashlib (GH-119316)Jonathan Protzenko2024-08-131-0/+462
| | | | | | | This replaces the existing hashlib Blake2 module with a single implementation that uses HACL\*'s Blake2b/Blake2s implementations. We added support for all the modes exposed by the Python API, including tree hashing, leaf nodes, and so on. We ported and merged all of these changes upstream in HACL\*, added test vectors based on Python's existing implementation, and exposed everything needed for hashlib. This was joint work done with @R1kM. See the PR for much discussion and benchmarking details. TL;DR: On many systems, 8-50% faster (!) than `libb2`, on some systems it appeared 10-20% slower than `libb2`.
* gh-122688: Add more tests for var-positional parameters in Argument Clinic ↵Serhiy Storchaka2024-08-121-56/+223
| | | | (GH-122900)
* gh-115808: Add ``is_none`` and ``is_not_none`` to ``operator`` (#115814)Nico Mexis2024-08-101-1/+19
| | | Co-authored-by: Kirill Podoprigora <kirill.bast9@mail.ru>
* gh-122688: Fix support of var-positional parameter in Argument Clinic ↵Serhiy Storchaka2024-08-091-37/+73
| | | | | | | | | (GH-122689) * Parameters after the var-positional parameter are now keyword-only instead of positional-or-keyword. * Correctly calculate min_kw_only. * Raise errors for invalid combinations of the var-positional parameter with "*", "/" and deprecation markers.
* gh-118814: Fix the TypeVar constructor when name is passed by keyword ↵Serhiy Storchaka2024-08-071-1/+73
| | | | | | | | (GH-122664) Fix _PyArg_UnpackKeywordsWithVararg for the case when argument for positional-or-keyword parameter is passed by keyword. There was only one such case in the stdlib -- the TypeVar constructor.
* gh-121381 Remove subprocess._USE_VFORK escape hatch (#121383)Cody Maloney2024-07-311-10/+5
| | | | | | | | | | | This flag was added as an escape hatch in gh-91401 and backported to Python 3.10. The flag broke at some point between its addition and now. As there is currently no publicly known environments that require this, remove it rather than work on fixing it. This leaves the flag in the subprocess module to not break code which may have used / checked the flag itself. discussion: https://discuss.python.org/t/subprocess-use-vfork-escape-hatch-broken-fix-or-remove/56915/2
* gh-118830: Bump pickle.DEFAULT_PROTOCOL to 5 (GH-119340)Rodrigo Oliveira2024-07-191-4/+4
|
* gh-121905: Consistently use "floating-point" instead of "floating point" ↵Serhiy Storchaka2024-07-194-10/+10
| | | | (GH-121907)
* gh-121592: Make select.poll() and related objects thread-safe (#121594)Sam Gross2024-07-111-5/+46
| | | | | | This makes select.poll() and kqueue() objects thread-safe in the free-threaded build. Note that calling close() concurrently with other functions is still not thread-safe due to races on file descriptors (gh-121544).
* gh-117657: Use critical section to make _socket.socket.close thread safe ↵AN Long2024-07-011-1/+28
| | | | (GH-120490)
* GH-107803: double linked list implementation for asyncio tasks (GH-107804)Kumar Aditya2024-06-221-1/+61
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * linked list * add tail optmiization to linked list * wip * wip * wip * more fixes * finally it works * add tests * remove weakreflist * add some comments * reduce code duplication in _asynciomodule.c * address some review comments * add invariants about the state of the linked list * add better explanation * clinic regen * reorder branches for better branch prediction * Update Modules/_asynciomodule.c * Apply suggestions from code review Co-authored-by: Itamar Oren <itamarost@gmail.com> * fix capturing of eager tasks * add comment to task finalization * fix tests and couple c implmentation to c task improved linked-list logic and more comments * fix test --------- Co-authored-by: Itamar Oren <itamarost@gmail.com>
* gh-113993: Allow interned strings to be mortal, and fix related issues ↵Petr Viktorin2024-06-219-72/+72
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | (GH-120520) * Add an InternalDocs file describing how interning should work and how to use it. * Add internal functions to *explicitly* request what kind of interning is done: - `_PyUnicode_InternMortal` - `_PyUnicode_InternImmortal` - `_PyUnicode_InternStatic` * Switch uses of `PyUnicode_InternInPlace` to those. * Disallow using `_Py_SetImmortal` on strings directly. You should use `_PyUnicode_InternImmortal` instead: - Strings should be interned before immortalization, otherwise you're possibly interning a immortalizing copy. - `_Py_SetImmortal` doesn't handle the `SSTATE_INTERNED_MORTAL` to `SSTATE_INTERNED_IMMORTAL` update, and those flags can't be changed in backports, as they are now part of public API and version-specific ABI. * Add private `_only_immortal` argument for `sys.getunicodeinternedsize`, used in refleak test machinery. * Make sure the statically allocated string singletons are unique. This means these sets are now disjoint: - `_Py_ID` - `_Py_STR` (including the empty string) - one-character latin-1 singletons Now, when you intern a singleton, that exact singleton will be interned. * Add a `_Py_LATIN1_CHR` macro, use it instead of `_Py_ID`/`_Py_STR` for one-character latin-1 singletons everywhere (including Clinic). * Intern `_Py_STR` singletons at startup. * For free-threaded builds, intern `_Py_LATIN1_CHR` singletons at startup. * Beef up the tests. Cover internal details (marked with `@cpython_only`). * Add lots of assertions Co-Authored-By: Eric Snow <ericsnowcurrently@gmail.com>
* gh-120780: Show attribute name for LOAD_SPECIAL in dis output (#120781)Jelle Zijlstra2024-06-201-1/+19
|
* gh-120057: Add os.environ.refresh() method (#120059)Victor Stinner2024-06-101-1/+19
|
* gh-119842: Honor PyOS_InputHook in the new REPL (GH-119843)Pablo Galindo Salgado2024-06-041-1/+37
| | | | | Signed-off-by: Pablo Galindo <pablogsal@gmail.com> Co-authored-by: Łukasz Langa <lukasz@langa.pl> Co-authored-by: Michael Droettboom <mdboom@gmail.com>
* gh-89928: Fix integer conversion of device numbers (GH-31794)Serhiy Storchaka2024-06-041-22/+10
| | | | | | Fix os.major(), os.minor() and os.makedev(). Support device numbers larger than 2**63-1. Support non-existent device number (NODEV).
* gh-119690: Adds Unicode support for named pipes in _winapi (GH-119717)Steve Dower2024-05-291-9/+15
|
* gh-119661: Add _Py_SINGLETON() include in Argumenet Clinic (#119712)Victor Stinner2024-05-297-10/+22
| | | | | When the _Py_SINGLETON() is used, Argument Clinic now adds an explicit "pycore_runtime.h" include to get the macro. Previously, the macro may or may not be included indirectly by another include.
* gh-117557: Improve error messages when a string, bytes or bytearray of ↵Serhiy Storchaka2024-05-283-43/+275
| | | | length 1 are expected (GH-117631)
* gh-118263: Add additional arguments to path_t (Argument Clinic type) in ↵Nice Zombies2024-05-241-92/+135
| | | | posixmodule (GH-118355)
* gh-69214: Fix fcntl.ioctl() request type (#119498)Victor Stinner2024-05-241-5/+6
| | | | Use an 'unsigned long' instead of an 'unsigned int' for the request parameter of fcntl.ioctl() to support requests larger than UINT_MAX.
* Remove almost all unpaired backticks in docstrings (#119231)Geoffrey Thomas2024-05-221-2/+2
| | | | | | | | | | | | | | | | | | As reported in #117847 and #115366, an unpaired backtick in a docstring tends to confuse e.g. Sphinx running on subclasses of standard library objects, and the typographic style of using a backtick as an opening quote is no longer in favor. Convert almost all uses of the form The variable `foo' should do xyz to The variable 'foo' should do xyz and also fix up miscellaneous other unpaired backticks (extraneous / missing characters). No functional change is intended here other than in human-readable docstrings.
* gh-119213: Be More Careful About _PyArg_Parser.kwtuple Across Interpreters ↵Eric Snow2024-05-221-1/+61
| | | | | | | | | (gh-119331) _PyArg_Parser holds static global data generated for modules by Argument Clinic. The _PyArg_Parser.kwtuple field is a tuple object, even though it's stored within a static global. In some cases the tuple is statically allocated and thus it's okay that it gets shared by multiple interpreters. However, in other cases the tuple is set lazily, allocated from the heap using the active interprepreter at the point the tuple is needed. This is a problem once that interpreter is destroyed since _PyArg_Parser.kwtuple becomes at dangling pointer, leading to crashes. It isn't a problem if the tuple is allocated under the main interpreter, since its lifetime is bound to the lifetime of the runtime. The solution here is to temporarily switch to the main interpreter. The alternative would be to always statically allocate the tuple. This change also fixes a bug where only the most recent parser was added to the global linked list.