summaryrefslogtreecommitdiffstats
path: root/Modules
Commit message (Collapse)AuthorAgeFilesLines
* gh-127614: Correctly check for ttyname_r() in configure (#128503)Erlend E. Aasland2025-01-072-4/+4
| | | | PR #14868 replaced the ttyname() call with ttyname_r(), but the old check remained.
* gh-127350: Add more tests for Py_fopen() (GH-128587)Serhiy Storchaka2025-01-072-21/+12
|
* gh-111178: fix UBSan failures in `Modules/_sre/sre.c` (GH-128250)Bénédikt Tran2025-01-071-35/+56
| | | fix UBSan failures for `PatternObject`, `MatchObject`, `TemplateObject`, `ScannerObject`
* gh-111178: fix UBSan failures in `Modules/_abc.c` (GH-128253)Bénédikt Tran2025-01-071-5/+9
| | | | * fix UBSan failures in `_abc.c` * suppress unused return values
* GH-128375: Better instrument for `FOR_ITER` (GH-128445)Mark Shannon2025-01-061-0/+21
|
* gh-127350: Add Py_fopen() and Py_fclose() functions (#127821)Victor Stinner2025-01-067-15/+98
|
* gh-102471: convert decimal module to use PyLong_Export API (PEP 757) (#128267)Sergey B Kirpichev2025-01-061-24/+27
|
* gh-128002: fix many thread safety issues in asyncio (#128147)Kumar Aditya2025-01-042-175/+869
| | | | | | * 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-128400: Only show the current thread in `faulthandler` if the GIL is ↵Peter Bierma2025-01-031-3/+30
| | | | disabled (GH-128425)
* gh-111178: fix UBSan failures in `Modules/zlibmodule.c` (GH-128252)Bénédikt Tran2025-01-031-5/+9
|
* gh-111178: fix UBSan failures in `Modules/curses*.c` (GH-128244)Bénédikt Tran2025-01-032-71/+114
| | | | | * fix UBSan failures in `_cursesmodule.c` * fix UBSan failures in `_curses_panel.c` * suppress an unused return value
* gh-111178: fix UBSan failures in `Modules/_csv.c` (GH-128243)Bénédikt Tran2025-01-031-28/+48
| | | Also: suppress unused return values
* gh-112015: Implement `ctypes.memoryview_at()` (GH-112018)Rian Hunter2025-01-031-0/+17
| | | | | Co-authored-by: Serhiy Storchaka <storchaka@gmail.com> Co-authored-by: Petr Viktorin <encukou@gmail.com> Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
* gh-128104: Remove `Py_STRFTIME_C99_SUPPORT`; require C99-compliant strftime ↵Zanie Blue2025-01-031-6/+0
| | | | (#128106)
* gh-128400: Stop-the-world when manually calling `faulthandler` (GH-128422)Peter Bierma2025-01-021-0/+5
|
* gh-126624: Expose error code ``XML_ERROR_NOT_STARTED`` of Expat >=2.6.4 ↵Sebastian Pipping2025-01-021-1/+4
| | | | | | | | | (#126625) Expose error code ``XML_ERROR_NOT_STARTED`` in `xml.parsers.expat.errors` which was introduced in Expat 2.6.4. Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
* gh-124130: Fix a bug in matching regular expression \B in empty string ↵Serhiy Storchaka2025-01-021-12/+0
| | | | (GH-127007)
* gh-123925: Fix building curses on platforms without libncursesw (GH-128405)Serhiy Storchaka2025-01-021-1/+1
|
* gh-128277: remove unnecessary critical section from `socket.close` (#128305)Kumar Aditya2025-01-012-11/+3
| | | Remove unnecessary critical section from `socket.close` as it now uses relaxed atomics for `sock_fd`.
* gh-128277: make globals variables thread safe in socket module (#128286)Kumar Aditya2024-12-311-33/+23
|
* gh-128277: use relaxed atomics for `sock_fd` (#128304)Kumar Aditya2024-12-311-65/+102
|
* gh-128279: Enhance the NetBSD compatibility for thread naming (#128280)Furkan Onder2024-12-281-0/+3
| | | Enhance NetBSD compatibility for thread naming in _threadmodule.c.
* gh-87138: convert blake2b/2s types to heap types (#127669)Bénédikt Tran2024-12-261-20/+69
|
* gh-124761: add `socket.SO_REUSEPORT_LB` (#124961)Thomas Grainger2024-12-261-0/+3
|
* gh-128198: Add missing error checks for usages of PyIter_Next() (GH-128199)Yan Yanchii2024-12-251-0/+13
|
* gh-128002: use internal llist implementation for asyncio tasks (#128256)Kumar Aditya2024-12-251-50/+20
|
* gh-128035: Add ssl.HAS_PHA to detect libssl PHA support (GH-128036)Will Childs-Klein2024-12-241-0/+6
| | | | | | * Add ssl.HAS_PHA to detect libssl Post-Handshake-Auth support Co-authored-by: Tomas R. <tomas.roun8@gmail.com> Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
* gh-128217: Validate the normalized_environment variable instead of the ↵Sergey Muraviov2024-12-241-1/+1
| | | | similarly named function (GH-128220)
* gh-127295: ctypes: Switch field accessors to fixed-width integers (GH-127297)Petr Viktorin2024-12-204-652/+501
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This should be a pure refactoring, without user-visible behaviour changes. Before this change, ctypes uses traditional native C types, usually identified by [`struct` format characters][struct-chars] when a short (and identifier-friendly) name is needed: - `signed char` (`b`) / `unsigned char` (`B`) - `short` (`h`) / `unsigned short` (`h`) - `int` (`i`) / `unsigned int` (`i`) - `long` (`l`) / `unsigned long` (`l`) - `long long` (`q`) / `unsigned long long` (`q`) These map to C99 fixed-width types, which this PR switches to: - - `int8_t`/`uint8_t` - `int16_t`/`uint16_t` - `int32_t`/`uint32_t` - `int64_t`/`uint64_t` The C standard doesn't guarantee that the “traditional” types must map to the fixints. But, [`ctypes` currently requires it][swapdefs], so the assumption won't break anything. By “map” I mean that the *size* of the types matches. The *alignment* requirements might not. This needs to be kept in mind but is not an issue in `ctypes` accessors, which [explicitly handle unaligned memory][memcpy] for the integer types. Note that there are 5 “traditional” C type sizes, but 4 fixed-width ones. Two of the former are functionally identical to one another; which ones they are is platform-specific (e.g. `int`==`long`==`int32_t`.) This means that one of the [current][current-impls-1] [implementations][current-impls-2] is redundant on any given platform. The fixint types are parametrized by the number of bytes/bits, and one bit for signedness. This makes it easier to autogenerate code for them or to write generic macros (though generic API like [`PyLong_AsNativeBytes`][PyLong_AsNativeBytes] is problematic for performance reasons -- especially compared to a `memcpy` with compile-time-constant size). When one has a *different* integer type, determining the corresponding fixint means a `sizeof` and signedness check. This is easier and more robust than the current implementations (see [`wchar_t`][sizeof-wchar_t] or [`_Bool`][sizeof-bool]). [swapdefs]: https://github.com/python/cpython/blob/v3.13.0/Modules/_ctypes/cfield.c#L420-L444 [struct-chars]: https://docs.python.org/3/library/struct.html#format-characters [current-impls-1]: https://github.com/python/cpython/blob/v3.13.0/Modules/_ctypes/cfield.c#L470-L653 [current-impls-2]: https://github.com/python/cpython/blob/v3.13.0/Modules/_ctypes/cfield.c#L703-L944 [memcpy]: https://github.com/python/cpython/blob/v3.13.0/Modules/_ctypes/cfield.c#L613 [PyLong_AsNativeBytes]: https://docs.python.org/3/c-api/long.html#c.PyLong_AsNativeBytes [sizeof-wchar_t]: https://github.com/python/cpython/blob/v3.13.0/Modules/_ctypes/cfield.c#L1547-L1555 [sizeof-bool]: https://github.com/python/cpython/blob/v3.13.0/Modules/_ctypes/cfield.c#L1562-L1572 Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
* gh-127946: Use a critical section for `CFuncPtr` attributes (GH-128109)Peter Bierma2024-12-202-29/+245
|
* gh-115999: Specialize `STORE_ATTR` in free-threaded builds. (gh-127838)Neil Schemenauer2024-12-191-0/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Add `_PyDictKeys_StringLookupSplit` which does locking on dict keys and use in place of `_PyDictKeys_StringLookup`. * Change `_PyObject_TryGetInstanceAttribute` to use that function in the case of split keys. * Add `unicodekeys_lookup_split` helper which allows code sharing between `_Py_dict_lookup` and `_PyDictKeys_StringLookupSplit`. * Fix locking for `STORE_ATTR_INSTANCE_VALUE`. Create `_GUARD_TYPE_VERSION_AND_LOCK` uop so that object stays locked and `tp_version_tag` cannot change. * Pass `tp_version_tag` to `specialize_dict_access()`, ensuring the version we store on the cache is the correct one (in case of it changing during the specalize analysis). * Split `analyze_descriptor` into `analyze_descriptor_load` and `analyze_descriptor_store` since those don't share much logic. Add `descriptor_is_class` helper function. * In `specialize_dict_access`, double check `_PyObject_GetManagedDict()` in case we race and dict was materialized before the lock. * Avoid borrowed references in `_Py_Specialize_StoreAttr()`. * Use `specialize()` and `unspecialize()` helpers. * Add unit tests to ensure specializing happens as expected in FT builds. * Add unit tests to attempt to trigger data races (useful for running under TSAN). * Add `has_split_table` function to `_testinternalcapi`.
* GH-122548: Implement branch taken and not taken events for sys.monitoring ↵Mark Shannon2024-12-191-3/+22
| | | | (GH-122564)
* gh-128008: Add `PyWeakref_IsDead()` (GH-128009)Sam Gross2024-12-191-0/+14
| | | | | | | | | The `PyWeakref_IsDead()` function tests if a weak reference is dead without any side effects. Although you can also detect if a weak reference is dead using `PyWeakref_GetRef()`, that function returns a strong reference that must be `Py_DECREF()`'d, which can introduce side effects if the last reference is concurrently dropped (at least in the free threading build).
* gh-128083: Fix macro redefinition warning in clinic. (GH-127950)Peter Bierma2024-12-192-2/+59
|
* gh-127688: Add `SCHED_DEADLINE` and `SCHED_NORMAL` constants to `os` module ↵RUANG (James Roy)2024-12-191-0/+10
| | | | (GH-127689)
* gh-121621: clear running loop early in asyncio (#128004)Kumar Aditya2024-12-181-0/+5
|
* gh-127949: deprecate `asyncio.get_event_loop_policy` (#128053)Kumar Aditya2024-12-181-1/+1
| | | This deprecates `asyncio.get_event_loop_policy` and will be removed in Python 3.16.
* gh-127897: fix HACL* build on macOS/Catalina (GH-127932)aeiouaeiouaeiouaeiouaeiouaeiou2024-12-182-1/+23
| | | | | | | gh-127897: Update HACL* module from upstream sources to get: - Lib_Memzero0.c: don't use memset_s() on macOS <10.9 - Use _mm_malloc() for KRML_ALIGNED_MALLOC on macOS <10.15 - Add LEGACY_MACOS macros, use _mm_free() for KRML_ALIGNED_FREE on macOS <10.15
* gh-126742: Add _PyErr_SetLocaleString, use it for gdbm & dlerror messages ↵Bénédikt Tran2024-12-178-53/+68
| | | | | | | | (GH-126746) - Add a helper to set an error from locale-encoded `char*` - Use the helper for gdbm & dlerror messages Co-authored-by: Victor Stinner <vstinner@python.org>
* gh-126907: make `atexit` thread safe in free-threading (#127935)Peter Bierma2024-12-161-78/+75
| | | | Co-authored-by: Victor Stinner <vstinner@python.org> Co-authored-by: Kumar Aditya <kumaraditya@python.org>
* gh-111178: fix UBSan failures in `_elementtree.c` (#127982)Bénédikt Tran2024-12-161-53/+80
|
* GH-126985: Don't override venv detection with PYTHONHOME (#127968)Filipe Laíns 🇵🇸2024-12-151-3/+7
|
* getpath: Add comments highlighing details of the pyvenv.cfg detection (#127966)Filipe Laíns 🇵🇸2024-12-151-0/+11
|
* gh-102471, PEP 757: Add PyLong import and export API (#121339)Victor Stinner2024-12-131-0/+124
| | | | | Co-authored-by: Sergey B Kirpichev <skirpichev@gmail.com> Co-authored-by: Steve Dower <steve.dower@microsoft.com> Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
* gh-127870: Detect recursive calls in ctypes _as_parameter_ handling (#127872)Victor Stinner2024-12-131-1/+21
|
* GH-125174: Mark objects as statically allocated. (#127797)Mark Shannon2024-12-111-0/+10
| | | | | * Set a bit in the unused part of the refcount on 64 bit machines and the free-threaded build. * Use the top of the refcount range on 32 bit machines
* gh-127065: Make methodcaller thread-safe and re-entrant (GH-127746)Pieter Eendebak2024-12-111-96/+84
| | | | | | | | | | | The function `operator.methodcaller` was not thread-safe since the additional of the vectorcall method in gh-89013. In the free threading build the issue is easy to trigger, for the normal build harder. This makes the `methodcaller` safe by: * Replacing the lazy initialization with initialization in the constructor. * Using a stack allocated space for the vectorcall arguments and falling back to `tp_call` for calls with more than 8 arguments.
* gh-126992: Change pickle code to base 10 for load_long and load_int (GH-127042)Justin Applegate2024-12-111-7/+4
| | | Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
* gh-127791: Fix, document, and test `PyUnstable_AtExit` (#127793)Peter Bierma2024-12-113-38/+56
|
* gh-59705: Set OS thread name when Thread.name is changed (#127702)Victor Stinner2024-12-101-2/+1
| | | Co-authored-by: Petr Viktorin <encukou@gmail.com>