summaryrefslogtreecommitdiffstats
path: root/Modules/clinic
Commit message (Collapse)AuthorAgeFilesLines
* [3.13] gh-119842: Honor PyOS_InputHook in the new REPL (GH-119843) (GH-120066)Łukasz Langa2024-06-041-1/+37
| | | | | | | (cherry picked from commit d9095194dde27eaabfc0b86a11989cdb9a2acfe1) Signed-off-by: Pablo Galindo <pablogsal@gmail.com> Co-authored-by: Pablo Galindo Salgado <Pablogsal@gmail.com> Co-authored-by: Michael Droettboom <mdboom@gmail.com>
* [3.13] gh-89928: Fix integer conversion of device numbers (GH-31794) (GH-120053)Miss Islington (bot)2024-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). (cherry picked from commit 7111d9605f9db7aa0b095bb8ece7ccc0b8115c3f) Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
* [3.13] Revert "[3.13] gh-69214: Fix fcntl.ioctl() request type (GH-119498) ↵Victor Stinner2024-06-011-6/+5
| | | | | | | | | | (… (#119906) Revert "[3.13] gh-69214: Fix fcntl.ioctl() request type (GH-119498) (#119504)" This reverts commit 0bab0b3a53da735838720f96f3d3bf86ca6ba125. The change modified how negative values, like termios.TIOCSWINSZ, was treated and is actually backward incompatible.
* gh-119690: Adds Unicode support for named pipes in _winapi (GH-119717)Miss Islington (bot)2024-05-311-9/+15
| | | | | (cherry picked from commit 78d697b7d5ec2a6fa046b0e1c34e804f49e750b4) Co-authored-by: Steve Dower <steve.dower@python.org>
* [3.13] gh-119661: Add _Py_SINGLETON() include in Argumenet Clinic (#119712) ↵Victor Stinner2024-05-297-10/+22
| | | | | | | | | | | (#119716) gh-119661: Add _Py_SINGLETON() include in Argumenet Clinic (#119712) 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. (cherry picked from commit 7ca74a760a5d3cdf48159f003d4db7c2778e9261)
* gh-118263: Add additional arguments to path_t (Argument Clinic type) in ↵Miss Islington (bot)2024-05-241-92/+135
| | | | | | | posixmodule (GH-118355) (cherry picked from commit 96b392df303b2cfaea823afcb462c0b455704ce8) Co-authored-by: Nice Zombies <nineteendo19d0@gmail.com>
* [3.13] gh-69214: Fix fcntl.ioctl() request type (GH-119498) (#119504)Miss Islington (bot)2024-05-241-5/+6
| | | | | | | | | gh-69214: Fix fcntl.ioctl() request type (GH-119498) Use an 'unsigned long' instead of an 'unsigned int' for the request parameter of fcntl.ioctl() to support requests larger than UINT_MAX. (cherry picked from commit 92fab3356f4c61d4c73606e4fae705c6d8f6213b) Co-authored-by: Victor Stinner <vstinner@python.org>
* [3.13] gh-119213: Be More Careful About _PyArg_Parser.kwtuple Across ↵Miss Islington (bot)2024-05-221-1/+61
| | | | | | | | | | | | | Interpreters (gh-119331) (gh-119410) _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. (cherry picked from commit 81865002aee8eaaeb3c7e402f86183afa6de77bf) Co-authored-by: Eric Snow <ericsnowcurrently@gmail.com>
* gh-118507 : Refactor `nt._path_is*` to improve applicability for other cases ↵Miss Islington (bot)2024-05-221-32/+124
| | | | | | | (GH-118755) (cherry picked from commit b64182550f73e556344bd754d32e3be5d22a74e1) Co-authored-by: Nice Zombies <nineteendo19d0@gmail.com>
* gh-66410: Do not stringify arguments of Tkinter callback (GH-98592)Serhiy Storchaka2024-05-071-4/+4
| | | | | | | | | Callbacks registered in the tkinter module now take arguments as various Python objects (int, float, bytes, tuple), not just str. To restore the previous behavior set tkinter module global wantobject to 1 before creating the Tk object or call the wantobject() method of the Tk object with argument 1. Calling it with argument 2 restores the current default behavior.
* gh-71592: Add ability to trace Tcl commands executed by Tkinter (GH-118291)Serhiy Storchaka2024-05-061-1/+28
| | | | | | | | | | | | This is an experimental feature, for internal use. Setting tkinter._debug = True before creating the root window enables printing every executed Tcl command (or a Tcl command equivalent to the used Tcl C API). This will help to convert a Tkinter example into Tcl script to check whether the issue is caused by Tkinter or exists in the underlying Tcl/Tk library.
* gh-102511: Speed up os.path.splitroot() with native helpers (GH-118089)Nice Zombies2024-04-251-1/+59
|
* gh-117680: make _PyInstructionSequence a PyObject and use it in tests (#117629)Irit Katriel2024-04-171-1/+19
|
* gh-117613: Argument Clinic: ensure that 'defining_class' params are ↵neonene2024-04-161-2/+2
| | | | positional-only (#117781)
* gh-117613: Enhance test_clinic @defining_class tests (#117896)Victor Stinner2024-04-161-10/+66
|
* gh-90329: Add _winapi.GetLongPathName and GetShortPathName and use in venv ↵Steve Dower2024-04-151-1/+141
| | | | to reduce warnings (GH-117817)
* gh-117764: Use Argument Clinic for signal.set_wakeup_fd() (GH-117777)Serhiy Storchaka2024-04-121-1/+76
|
* gh-111926: Make weakrefs thread-safe in free-threaded builds (#117168)mpage2024-04-081-19/+1
| | | | | | | | | Most mutable data is protected by a striped lock that is keyed on the referenced object's address. The weakref's hash is protected using the weakref's per-object lock. Note that this only affects free-threaded builds. Apart from some minor refactoring, the added code is all either gated by `ifdef`s or is a no-op (e.g. `Py_BEGIN_CRITICAL_SECTION`).
* gh-117440: Make `syslog` thread-safe in free-threaded builds (#117441)Sam Gross2024-04-021-2/+13
| | | Use critical sections to protect access to the syslog module.
* gh-112383: teach dis how to interpret ENTER_EXECUTOR (#117171)Irit Katriel2024-03-231-1/+61
|
* 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)