]> git.ipfire.org Git - thirdparty/Python/cpython.git/log
thirdparty/Python/cpython.git
7 months agogh-126033: fix UAF in `xml.etree.ElementTree.Element.remove` when concurrent mutation...
Bénédikt Tran [Mon, 31 Mar 2025 10:31:26 +0000 (12:31 +0200)] 
gh-126033: fix UAF in `xml.etree.ElementTree.Element.remove` when concurrent mutations happen (#126124)

7 months agogh-126037: fix UAF in `xml.etree.ElementTree.Element.find*` when concurrent mutation...
Bénédikt Tran [Mon, 31 Mar 2025 10:26:52 +0000 (12:26 +0200)] 
gh-126037:  fix UAF in `xml.etree.ElementTree.Element.find*` when concurrent mutations happen (#127964)

We fix a use-after-free in the `find`, `findtext` and `findall` methods of `xml.etree.ElementTree.Element`
objects that can be triggered when the tag to find implements an `__eq__` method that mutates the
element being queried.

7 months agogh-130167: Optimise ``textwrap.dedent()`` (#131919)
Adam Turner [Mon, 31 Mar 2025 00:35:12 +0000 (01:35 +0100)] 
gh-130167: Optimise ``textwrap.dedent()`` (#131919)

Co-authored-by: Marius Juston <marius.juston@hotmail.fr>
Co-authored-by: Pieter Eendebak <pieter.eendebak@gmail.com>
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
7 months agoGH-131798: Remove type checks for _TO_BOOL_STR (GH-131816)
Amit Lavon [Sun, 30 Mar 2025 23:07:25 +0000 (16:07 -0700)] 
GH-131798: Remove type checks for _TO_BOOL_STR (GH-131816)

7 months agogh-131895: fix clang `$PATH` on Darwin runners for tail-calling interpreter (#131903)
Bénédikt Tran [Sun, 30 Mar 2025 18:48:00 +0000 (20:48 +0200)] 
gh-131895: fix clang `$PATH` on Darwin runners for tail-calling interpreter (#131903)

7 months agoUpdate cryptographic CODEOWNERS entry (#131892)
Bénédikt Tran [Sun, 30 Mar 2025 17:55:05 +0000 (19:55 +0200)] 
Update cryptographic CODEOWNERS entry (#131892)

update cryptographic CODEOWNERS entry

7 months agogh-127794: Validate email header names according to RFC 5322 (#127820)
Srinivas Reddy Thatiparthy (తాటిపర్తి శ్రీనివాస్ రెడ్డి) [Sun, 30 Mar 2025 12:29:29 +0000 (17:59 +0530)] 
gh-127794: Validate email header names according to RFC 5322 (#127820)

`email.message.Message` objects now validate header names specified via `__setitem__`
or `add_header` according to RFC 5322, §2.2 [1].

In particular, callers should expect a ValueError to be raised for invalid header names.

[1]: https://datatracker.ietf.org/doc/html/rfc5322#section-2.2

---------

Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
Co-authored-by: R. David Murray <rdmurray@bitdance.com>
7 months agogh-131178: Update help message for `timeit` CLI (#131326)
Semyon Moroz [Sun, 30 Mar 2025 11:19:38 +0000 (15:19 +0400)] 
gh-131178: Update help message for `timeit` CLI (#131326)

7 months agogh-127945: mark `TestLocalization` as thread unsafe in ctypes (#131899)
Kumar Aditya [Sun, 30 Mar 2025 11:08:42 +0000 (16:38 +0530)] 
gh-127945: mark `TestLocalization` as thread unsafe in ctypes (#131899)

7 months agogh-127945: acquire critical section around `PyCFuncPtr_call` (#131898)
Kumar Aditya [Sun, 30 Mar 2025 11:01:12 +0000 (16:31 +0530)] 
gh-127945: acquire critical section around `PyCFuncPtr_call` (#131898)

7 months agogh-127945: make initialization of `error_object_name` thread safe in ctypes (#131896)
Kumar Aditya [Sun, 30 Mar 2025 10:50:35 +0000 (16:20 +0530)] 
gh-127945: make initialization of `error_object_name` thread safe in ctypes (#131896)

7 months agogh-127945: fix thread safety of creating instances of ctypes structures (#131716)
Kumar Aditya [Sun, 30 Mar 2025 09:52:30 +0000 (15:22 +0530)] 
gh-127945: fix thread safety of creating instances of ctypes structures (#131716)

7 months agogh-131885: Document that `dict.setdefault` and `dict.get` take no keyword arguments...
Adam Dangoor [Sun, 30 Mar 2025 09:22:57 +0000 (10:22 +0100)] 
gh-131885: Document that `dict.setdefault` and `dict.get` take no keyword arguments (#128208)

7 months agogh-129994: update docs when using `dualstack_ipv6` in `socket.create_server` (#129996)
Alexander Ershov [Sun, 30 Mar 2025 08:19:36 +0000 (15:19 +0700)] 
gh-129994: update docs when using `dualstack_ipv6` in `socket.create_server` (#129996)

7 months agoGH-129149: Add fast path for medium-sized integers in `PyLong_From*` functions (...
Chris Eibl [Sun, 30 Mar 2025 08:12:42 +0000 (10:12 +0200)] 
GH-129149: Add fast path for medium-sized integers in `PyLong_From*` functions (#131211)

Add a fast path for medium-sized integers in `PyLong_FromInt{32,64}` and `PyLong_FromUInt{32,64}`.

7 months agogh-130924: Do not create cells for usages of names in local annotations (#131843)
Jelle Zijlstra [Sat, 29 Mar 2025 21:15:48 +0000 (14:15 -0700)] 
gh-130924: Do not create cells for usages of names in local annotations (#131843)

7 months agogh-131853: Fix test_msgfmt on big-endian platforms (GH-131879)
Serhiy Storchaka [Sat, 29 Mar 2025 17:14:37 +0000 (19:14 +0200)] 
gh-131853: Fix test_msgfmt on big-endian platforms (GH-131879)

Use a generated .mo file instead of a checked in one.

7 months agogh-131853: Test binary header in msgfmt generated file (GH-131854)
Stan Ulbrych [Sat, 29 Mar 2025 12:27:50 +0000 (12:27 +0000)] 
gh-131853: Test binary header in msgfmt generated file (GH-131854)

7 months agogh-131050: skip `test_dh_params` when TLS library lacks FFDHE ciphersuites (#131051)
Will Childs-Klein [Sat, 29 Mar 2025 10:31:48 +0000 (06:31 -0400)] 
gh-131050: skip `test_dh_params` when TLS library lacks FFDHE ciphersuites (#131051)

Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
7 months agogh-127541: Update os.walk example (GH-127765)
Totosuki [Sat, 29 Mar 2025 06:25:13 +0000 (15:25 +0900)] 
gh-127541: Update os.walk example (GH-127765)

Update os.walk example to be more modern, skip `__pycache__` dirs rather than `CVS` dirs.

Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
7 months agogh-131740: minor readability fix in PyUnstable_GC_VisitObjects (gh-131786)
Martin DeMello [Fri, 28 Mar 2025 23:58:17 +0000 (16:58 -0700)] 
gh-131740: minor readability fix in PyUnstable_GC_VisitObjects (gh-131786)

Minor readability fix in PyUnstable_GC_VisitObjects

Replaces `if (visit_generation())` with `if (visit_generation() < 0)`,
since we are checking for the failure case, and it's confusing to have
that be implicitly `true`.

Also fixes a misspelt variable name.

7 months agogh-130373: Avoid locking in _LOAD_ATTR_WITH_HINT (#130372)
Dino Viehland [Fri, 28 Mar 2025 22:16:41 +0000 (15:16 -0700)] 
gh-130373: Avoid locking in _LOAD_ATTR_WITH_HINT (#130372)

Avoid locking in _LOAD_ATTR_WITH_HINT

7 months agodocs: -I also implies -P (#131539)
Ned Batchelder [Fri, 28 Mar 2025 18:59:03 +0000 (12:59 -0600)] 
docs: -I also implies -P (#131539)

7 months agogh-131423: Update to OpenSSL 3.0.16. (GH-131839)
Steve Dower [Fri, 28 Mar 2025 15:07:57 +0000 (15:07 +0000)] 
gh-131423: Update to OpenSSL 3.0.16. (GH-131839)

The bin tag is 3.0.16.1 because we rebuilt without uplink support to fix gh-131804.
This PR also prevents making calls that are now unsafe without uplink, and updates
the tests to property interpret these failures as unsupported.

7 months agoGH-131678: fix Windows tail-call CI does not run the test cases (GH-131690)
Chris Eibl [Fri, 28 Mar 2025 15:00:36 +0000 (16:00 +0100)] 
GH-131678: fix Windows tail-call CI does not run the test cases (GH-131690)

7 months agogh-131807: fix ResourceWarning in test_ucn.py (#131808)
Thomas Grainger [Fri, 28 Mar 2025 14:55:40 +0000 (14:55 +0000)] 
gh-131807: fix ResourceWarning in test_ucn.py (#131808)

Co-authored-by: Victor Stinner <vstinner@python.org>
7 months agoUse `assert*` comparison methods in `test_timer_comparison` (#129513)
alexey semenyuk [Fri, 28 Mar 2025 14:25:13 +0000 (19:25 +0500)] 
Use `assert*` comparison methods in `test_timer_comparison` (#129513)

7 months agogh-117174: Adapt `test_multiple_statements_fail_early` to new REPL behavior (follow...
Bartosz Sławecki [Fri, 28 Mar 2025 14:09:31 +0000 (15:09 +0100)] 
gh-117174: Adapt `test_multiple_statements_fail_early` to new REPL behavior (follow-up gh-131065) (#131836)

Adapt test to new REPL behavior (follow-up gh-117174)

7 months agogh-128002: run all asyncio tests with tsan CI (#131797)
Kumar Aditya [Fri, 28 Mar 2025 14:00:36 +0000 (19:30 +0530)] 
gh-128002: run all asyncio tests with tsan CI (#131797)

7 months agogh-131738: optimize builtin any/all/tuple calls with a generator expression arg ...
Irit Katriel [Fri, 28 Mar 2025 10:35:20 +0000 (10:35 +0000)] 
gh-131738: optimize builtin any/all/tuple calls with a generator expression arg (#131737)

7 months agogh-126835: Refine constant folding tests in `test_peepholer.py::TestTranforms` (...
Yan Yanchii [Fri, 28 Mar 2025 10:10:22 +0000 (11:10 +0100)] 
gh-126835: Refine constant folding tests in `test_peepholer.py::TestTranforms` (#131826)

7 months agogh-131818: Add imply `-P` in `-I`'s help message (#131819)
Hang [Fri, 28 Mar 2025 07:49:13 +0000 (15:49 +0800)] 
gh-131818: Add imply `-P` in `-I`'s help message (#131819)

7 months agogh-119180: Use equality when comparing against `annotationlib.Format` (#131755)
Victorien [Fri, 28 Mar 2025 04:56:09 +0000 (05:56 +0100)] 
gh-119180: Use equality when comparing against `annotationlib.Format` (#131755)

7 months agogh-128770: raise warnings as errors in test suite - except for test_socket which...
Thomas Grainger [Thu, 27 Mar 2025 19:06:52 +0000 (19:06 +0000)] 
gh-128770: raise warnings as errors in test suite - except for test_socket which still logs warnings, and internal test warnings that are now logged (#128973)

Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
7 months agoGH-130415: Remove redundant sym_matches_type calls in the JIT optimizer (GH-131778)
Brandt Bucher [Thu, 27 Mar 2025 16:12:30 +0000 (09:12 -0700)] 
GH-130415: Remove redundant sym_matches_type calls in the JIT optimizer (GH-131778)

7 months agogh-128438: Use `EnvironmentVarGuard` for `datetimetester.py` to manage environment...
Wulian233 [Thu, 27 Mar 2025 16:07:09 +0000 (00:07 +0800)] 
gh-128438: Use `EnvironmentVarGuard` for `datetimetester.py` to manage environment varibales (#130002)

7 months agogh-131178: Add tests for `tokenize` command-line interface (#131274)
Semyon Moroz [Thu, 27 Mar 2025 16:04:16 +0000 (20:04 +0400)] 
gh-131178: Add tests for `tokenize` command-line interface (#131274)

7 months agogh-131525: Cache the result of tuple_hash (#131529)
Michael Droettboom [Thu, 27 Mar 2025 13:57:06 +0000 (09:57 -0400)] 
gh-131525: Cache the result of tuple_hash (#131529)

* gh-131525: Cache the result of tuple_hash

* Fix debug builds

* Add blurb

* Fix formatting

* Pre-compute empty tuple singleton

* Mostly set the cache within tuple_alloc

* Fixes for TSAN

* Pre-compute empty tuple singleton

* Fix for 32-bit platforms

* Assert that op != NULL in _PyTuple_RESET_HASH_CACHE

* Use FT_ATOMIC_STORE_SSIZE_RELAXED macro

* Update Include/internal/pycore_tuple.h

Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
* Fix alignment

* atomic load

* Update Objects/tupleobject.c

Co-authored-by: Chris Eibl <138194463+chris-eibl@users.noreply.github.com>
---------

Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
Co-authored-by: Chris Eibl <138194463+chris-eibl@users.noreply.github.com>
7 months agogh-118761: Always lazy import `re` in `locale` (#129860)
Semyon Moroz [Thu, 27 Mar 2025 13:47:08 +0000 (17:47 +0400)] 
gh-118761: Always lazy import `re` in `locale` (#129860)

7 months agogh-111178: Skip undefined behavior checks in _PyPegen_lookahead() (#131714)
Victor Stinner [Thu, 27 Mar 2025 09:03:58 +0000 (10:03 +0100)] 
gh-111178: Skip undefined behavior checks in _PyPegen_lookahead() (#131714)

For example, expression_rule() return type is 'expr_ty', whereas
_PyPegen_lookahead() uses 'void*'.

7 months agogh-131712: Build _suggestions extension on Windows (#131759)
Victor Stinner [Thu, 27 Mar 2025 08:53:39 +0000 (09:53 +0100)] 
gh-131712: Build _suggestions extension on Windows (#131759)

Add a test checking that the '_suggestions' extension is available.

7 months agoGH-131729: Consider in-memory state when merging storage and stack (GH-131773)
Mark Shannon [Thu, 27 Mar 2025 08:32:45 +0000 (08:32 +0000)] 
GH-131729: Consider in-memory state when merging storage and stack (GH-131773)

7 months agoRevise `pycore_stackref.h` comments. (#130601)
Neil Schemenauer [Thu, 27 Mar 2025 08:30:25 +0000 (01:30 -0700)] 
Revise `pycore_stackref.h` comments. (#130601)

7 months agogh-131782: Fix cast to match type of `bits` in `_Py_TryIncrefCompareStackRef` (#131783)
Neil Schemenauer [Thu, 27 Mar 2025 08:28:59 +0000 (01:28 -0700)] 
gh-131782: Fix cast to match type of `bits` in `_Py_TryIncrefCompareStackRef` (#131783)

7 months agogh-131763: Replace the redundant check with assert in remove_tools (#131765)
Sergey Muraviov [Wed, 26 Mar 2025 22:36:04 +0000 (01:36 +0300)] 
gh-131763: Replace the redundant check with assert in remove_tools (#131765)

7 months agogh-131236: allow to generate multiple UUIDs at once via CLI (#131218)
Simon Legner [Wed, 26 Mar 2025 20:49:28 +0000 (21:49 +0100)] 
gh-131236: allow to generate multiple UUIDs at once via CLI (#131218)

Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
7 months agoGH-119866: Don't clear frame->stackpointer on release builds (GH-131750)
Brandt Bucher [Wed, 26 Mar 2025 19:00:16 +0000 (12:00 -0700)] 
GH-119866: Don't clear frame->stackpointer on release builds (GH-131750)

7 months agogh-131762: Fixed dereferencing the pointer 'parser_token->metadata' with a NULL value...
rialbat [Wed, 26 Mar 2025 18:44:56 +0000 (21:44 +0300)] 
gh-131762: Fixed dereferencing the pointer 'parser_token->metadata' with a NULL value (#131764)

7 months agogh-131586: Avoid refcount contention in some "special" calls (#131588)
Sam Gross [Wed, 26 Mar 2025 18:38:47 +0000 (14:38 -0400)] 
gh-131586: Avoid refcount contention in some "special" calls (#131588)

In the free threaded build, the `_PyObject_LookupSpecial()` call can lead to
reference count contention on the returned function object becuase it
doesn't use stackrefs. Refactor some of the callers to use
`_PyObject_MaybeCallSpecialNoArgs`, which uses stackrefs internally.

This fixes the scaling bottleneck in the "lookup_special" microbenchmark
in `ftscalingbench.py`. However, the are still some uses of
`_PyObject_LookupSpecial()` that need to be addressed in future PRs.

7 months agogh-123358: Use `_PyStackRef` in `LOAD_DEREF` (gh-130064)
Sam Gross [Wed, 26 Mar 2025 16:08:20 +0000 (12:08 -0400)] 
gh-123358: Use `_PyStackRef` in `LOAD_DEREF` (gh-130064)

Concurrent accesses from multiple threads to the same `cell` object did not
scale well in the free-threaded build. Use `_PyStackRef` and optimistically
avoid locking to improve scaling.

With the locks around cell reads gone, some of the free threading tests were
prone to starvation: the readers were able to run in a tight loop and the
writer threads weren't scheduled frequently enough to make timely progress.
Adjust the tests to avoid this.

Co-authored-by: Donghee Na <donghee.na@python.org>
7 months agoGH-131729: Code-gen better liveness analysis (GH-131732)
Mark Shannon [Wed, 26 Mar 2025 15:21:35 +0000 (15:21 +0000)] 
GH-131729: Code-gen better liveness analysis (GH-131732)

* Rename 'defined' attribute to 'in_local' to more accurately reflect how it is used

* Make death of variables explicit even for array variables.

* Convert in_memory from boolean to stack offset

* Don't apply liveness analysis to optimizer generated code

* Fix RETURN_VALUE in optimizer

7 months agogh-131741: Add documentation for Windows version detection change in `platform` ...
Idan Noiman [Wed, 26 Mar 2025 14:50:37 +0000 (16:50 +0200)] 
gh-131741: Add documentation for Windows version detection change in `platform` (#131742)

Document the behavior change between 3.11 & 3.12, where ``platform`` now correctly detects Windows 11 and Windows Server releases past Windows Server 2012.

Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
Co-authored-by: Wulian <1055917385@qq.com>
7 months agogh-131649: fix test_string_literals SyntaxWarning (#131650)
Thomas Grainger [Wed, 26 Mar 2025 14:01:18 +0000 (14:01 +0000)] 
gh-131649: fix test_string_literals SyntaxWarning (#131650)

7 months agogh-117657: Fix data race in `compare_unicode_unicode_threadsafe` (gh-131746)
Sam Gross [Wed, 26 Mar 2025 13:01:57 +0000 (09:01 -0400)] 
gh-117657: Fix data race in `compare_unicode_unicode_threadsafe` (gh-131746)

We can't safely check the type of the found key until we incref it or if we know that it's immortal.

7 months agodocument that `sys._is_gil_enabled` is CPython-specific (#131748)
Ralf Gommers [Wed, 26 Mar 2025 12:02:52 +0000 (13:02 +0100)] 
document that `sys._is_gil_enabled` is CPython-specific (#131748)

7 months agogh-130881: Handle conditionally defined annotations (#130935)
Jelle Zijlstra [Wed, 26 Mar 2025 03:48:19 +0000 (20:48 -0700)] 
gh-130881: Handle conditionally defined annotations (#130935)

7 months agogh-131740: Update PyUnstable_GC_VisitObjects to traverse perm gen (gh-131744)
Donghee Na [Wed, 26 Mar 2025 00:45:29 +0000 (09:45 +0900)] 
gh-131740: Update PyUnstable_GC_VisitObjects to traverse perm gen (gh-131744)

7 months agoGH-130673: Gracefully handle missing sections in JIT build (GH-130906)
Bojun Ren [Tue, 25 Mar 2025 23:35:39 +0000 (07:35 +0800)] 
GH-130673: Gracefully handle missing sections in JIT build (GH-130906)

7 months agoGH-131691: Fix exception handling setting for clang-cl on Windows (GH-131730)
Chris Eibl [Tue, 25 Mar 2025 23:07:52 +0000 (00:07 +0100)] 
GH-131691: Fix exception handling setting for clang-cl on Windows (GH-131730)

The /EHa option for Clang-CL behaves differently than the same option for MSVC, which is why we don't use it for both compilers.

7 months agogh-129900: Fix `SystemExit` return codes when the REPL is started from the command...
Peter Bierma [Tue, 25 Mar 2025 19:48:46 +0000 (15:48 -0400)] 
gh-129900: Fix `SystemExit` return codes when the REPL is started from the command line (#129901)

7 months agogh-131647: fix 'sys.path_hooks is empty' warning in test_importlib (#131648)
Thomas Grainger [Tue, 25 Mar 2025 17:16:15 +0000 (17:16 +0000)] 
gh-131647: fix 'sys.path_hooks is empty' warning in test_importlib (#131648)

7 months agoGH-130887: Always remove trailing jumps in AArch64 JIT stencils (GH-131042)
Diego Russo [Tue, 25 Mar 2025 17:15:36 +0000 (17:15 +0000)] 
GH-130887: Always remove trailing jumps in AArch64 JIT stencils (GH-131042)

7 months agogh-131719: add NULL pointer check to `_PyMem_FreeDelayed` (gh-131720)
Tomasz Pytel [Tue, 25 Mar 2025 14:49:18 +0000 (10:49 -0400)] 
gh-131719: add NULL pointer check to `_PyMem_FreeDelayed` (gh-131720)

7 months agogh-131711: Preventing the use of a null pointer in set_tp_mro (#131713)
Sergey Muraviov [Tue, 25 Mar 2025 13:28:38 +0000 (16:28 +0300)] 
gh-131711: Preventing the use of a null pointer in set_tp_mro (#131713)

7 months agogh-127945: fix thread safety of ctypes state (#131710)
Kumar Aditya [Tue, 25 Mar 2025 11:33:05 +0000 (17:03 +0530)] 
gh-127945: fix thread safety of ctypes state (#131710)

This fixes thread safety of `array_cache` and `swapped_suffix` by initializing them in module exec to make it thread safety.

7 months agogh-127945: add locking to malloc closure in free-threading (#131662)
Kumar Aditya [Tue, 25 Mar 2025 11:18:46 +0000 (16:48 +0530)] 
gh-127945: add locking to malloc closure in free-threading (#131662)

The freelist is not thread safe in free-threading so this adds lock around it make it thread safe in free-threading.

7 months agogh-131707: fix unawaited coroutine warning in test_coroutines.Corouti… (#131708)
Thomas Grainger [Tue, 25 Mar 2025 08:29:51 +0000 (08:29 +0000)] 
gh-131707: fix unawaited coroutine warning in test_coroutines.Corouti… (#131708)

gh-131707: fix unawaited coroutine warning in test_coroutines.CoroutineTest.test_17

7 months agogh-128446: Run Windows CI tests on each commit (#131702)
Adam Turner [Tue, 25 Mar 2025 07:06:15 +0000 (07:06 +0000)] 
gh-128446: Run Windows CI tests on each commit (#131702)

7 months agogh-131666: mark `anext_awaitable.close` as a `METH_NOARGS` instead of `METH_VARARGS...
Bénédikt Tran [Tue, 25 Mar 2025 03:33:22 +0000 (04:33 +0100)] 
gh-131666: mark `anext_awaitable.close` as a `METH_NOARGS` instead of `METH_VARARGS` (#131671)

7 months agoGH-131473: Override PreferredToolArchitecture when using Visual Studio bundled clang...
Chris Eibl [Mon, 24 Mar 2025 23:15:51 +0000 (00:15 +0100)] 
GH-131473: Override PreferredToolArchitecture when using Visual Studio bundled clang-cl (GH-131689)

tweak PreferredToolArchitecture for bundled clang-cl

7 months agogh-127146: Fix Emscripten build with --pydebug (#131672)
Hood Chatham [Mon, 24 Mar 2025 21:43:31 +0000 (22:43 +0100)] 
gh-127146: Fix Emscripten build with --pydebug (#131672)

Removes an explicit check that sysconfigdata naming is correct, in favor of reporting at
runtime with the default mechanisms.

7 months agogh-131677: Fix flaky test_lru_cache_threaded3 (gh-131679)
Sam Gross [Mon, 24 Mar 2025 20:41:50 +0000 (16:41 -0400)] 
gh-131677: Fix flaky test_lru_cache_threaded3 (gh-131679)

The call to `with self.subTest(...)` was not thread-safe.

7 months agogh-130928: Fix error message during bytes formatting for the `'i'` flag (#130967)
Ageev Maxim [Mon, 24 Mar 2025 19:07:03 +0000 (22:07 +0300)] 
gh-130928: Fix error message during bytes formatting for the `'i'` flag (#130967)

7 months agogh-131670: Fix crash in `anext()` when `__anext__` is sync and raises (#131682)
sobolevn [Mon, 24 Mar 2025 19:00:48 +0000 (22:00 +0300)] 
gh-131670: Fix crash in `anext()` when `__anext__` is sync and raises (#131682)

Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
7 months agogh-111178: Fix function signature in pyexpat.c (#131674)
Victor Stinner [Mon, 24 Mar 2025 17:22:45 +0000 (18:22 +0100)] 
gh-111178: Fix function signature in pyexpat.c (#131674)

Move _Py_NO_SANITIZE_UNDEFINED macro from faulthandler.c to pyport.h.

7 months agoGH-131521: Uses correct build flags for zlib-ng on Windows (GH-131526)
Chris Eibl [Mon, 24 Mar 2025 16:21:57 +0000 (17:21 +0100)] 
GH-131521: Uses correct build flags for zlib-ng on Windows (GH-131526)

Do not enable AdvancedVectorExtensions2 for all *.c files, so that the resulting binary can be executed on older CPUs, too. Also enable AdvancedVectorExtensions512 where necessary, and add the ClangCL flags required to enable vector extensions.

7 months agogh-111178: fix UBSan for example code in `extending/newtypes_tutorial` docs (GH-131606)
Bénédikt Tran [Mon, 24 Mar 2025 16:15:32 +0000 (17:15 +0100)] 
gh-111178: fix UBSan for example code in `extending/newtypes_tutorial` docs (GH-131606)

Co-authored-by: Petr Viktorin <encukou@gmail.com>
7 months agoGH-128520: pathlib ABCs: tighten up argument types (#131621)
Barney Gale [Mon, 24 Mar 2025 15:39:08 +0000 (15:39 +0000)] 
GH-128520: pathlib ABCs: tighten up argument types (#131621)

In `JoinablePath.full_match()` and `ReadablePath.glob()`, accept a `str`
pattern argument rather than `JoinablePath | str`.

In `ReadablePath.copy()` and `copy_into()`, accept a `WritablePath` target
argument rather than `WritablePath | str`.

7 months agogh-115684: Clarify datetime `replace` documentation (#116519)
David Lowry-Duda [Mon, 24 Mar 2025 15:33:16 +0000 (11:33 -0400)] 
gh-115684: Clarify datetime `replace` documentation (#116519)

* Clarify datetime `replace` documentation

In #115684, HopedForLuck noted that `datetime.date.replace()`
documentation was confusing because it looked like it would be changing
immutable objects.

This documentation change specifies that the `replace()` methods in
`datetime` return new objects. This uses similar wording to the
documentation for `datetime.combine()`, which specifies that a new
datetime is returned. This is also similar to wording for
`string.replace()`, except `string.replace()` emphasizes that a "copy"
is returned.

Resolves #115684.

* Include reviewer comments

Thanks Privat33r-dev for the comments!

---------

Co-authored-by: Paul Ganssle <1377457+pganssle@users.noreply.github.com>
7 months agoGH-128520: pathlib ABCs: validate `magic_open()` arguments (#131617)
Barney Gale [Mon, 24 Mar 2025 15:13:18 +0000 (15:13 +0000)] 
GH-128520: pathlib ABCs: validate `magic_open()` arguments (#131617)

When `pathlib._os.magic_open()` is called to open a path in binary mode,
raise `ValueError` if any of the *encoding*, *errors* or *newline*
arguments are given. This matches the `open()` built-in.

7 months agoGH-128520: pathlib ABCs: reject empty pattern in `ReadablePath.glob()` (#127343)
Barney Gale [Mon, 24 Mar 2025 15:12:29 +0000 (15:12 +0000)] 
GH-128520: pathlib ABCs: reject empty pattern in `ReadablePath.glob()` (#127343)

For compatibility with `Path.glob()`, raise `ValueError` if an empty
pattern is given to `ReadablePath.glob()`.

7 months agoGH-131296: Remove unused variable from _wmimodule.cpp (GH-131587)
Chris Eibl [Mon, 24 Mar 2025 14:57:07 +0000 (15:57 +0100)] 
GH-131296: Remove unused variable from _wmimodule.cpp (GH-131587)

7 months agogh-111178: Fix function signatures for test_socket (#131667)
Victor Stinner [Mon, 24 Mar 2025 14:51:32 +0000 (15:51 +0100)] 
gh-111178: Fix function signatures for test_socket (#131667)

Add unicode_fsdecode() wrapper for PyUnicode_DecodeFSDefault() to use
the correct API for Py_BuildValue() converter API.

7 months agogh-111178: fix UBSan failures for `anextawaitableobject` (#131609)
Bénédikt Tran [Mon, 24 Mar 2025 14:43:48 +0000 (15:43 +0100)] 
gh-111178: fix UBSan failures for `anextawaitableobject` (#131609)

7 months agogh-111178: Skip tests which require deep stack if UBsan (#131669)
Victor Stinner [Mon, 24 Mar 2025 14:33:56 +0000 (15:33 +0100)] 
gh-111178: Skip tests which require deep stack if UBsan (#131669)

If Python is built with Undefined Behavior sanitizer, skip
test_repr_deep() of test_userdict and test_lru_recursion() of
test_functools.

7 months agogh-111178: Fix function signatures for test_capi (#131659)
Victor Stinner [Mon, 24 Mar 2025 14:04:45 +0000 (15:04 +0100)] 
gh-111178: Fix function signatures for test_capi (#131659)

Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
7 months agogh-111178: Fix function signature for test_threading (#131663)
Victor Stinner [Mon, 24 Mar 2025 13:56:45 +0000 (14:56 +0100)] 
gh-111178: Fix function signature for test_threading (#131663)

7 months agogh-128421: Avoid TSAN warnings in `sys._current_frames()` (gh-131548)
Sam Gross [Mon, 24 Mar 2025 13:49:39 +0000 (09:49 -0400)] 
gh-128421: Avoid TSAN warnings in `sys._current_frames()` (gh-131548)

This tells TSAN not to sanitize `PyUnstable_InterpreterFrame_GetLine()`.
There's a possible data race on the access to the frame's `instr_ptr`
if the frame is currently executing. We don't really care about the
race. In theory, we could use relaxed atomics for every access to
`instr_ptr`, but that would create more code churn and current compilers
are overly conservative with optimizations around relaxed atomic
accesses.

We also don't sanitize `_PyFrame_IsIncomplete()` because it accesses
`instr_ptr` and is called from assertions within PyFrame_GetCode().

7 months agogh-111178: Fix function signatures for test_zoneinfo (#131664)
Victor Stinner [Mon, 24 Mar 2025 13:32:46 +0000 (14:32 +0100)] 
gh-111178: Fix function signatures for test_zoneinfo (#131664)

7 months agogh-111178: Fix function signatures for test_ctypes (#131660)
Victor Stinner [Mon, 24 Mar 2025 13:30:13 +0000 (14:30 +0100)] 
gh-111178: Fix function signatures for test_ctypes (#131660)

7 months agogh-128715: Expose ctypes.CField, with info attributes (GH-128950)
Petr Viktorin [Mon, 24 Mar 2025 13:18:34 +0000 (14:18 +0100)] 
gh-128715: Expose ctypes.CField, with info attributes (GH-128950)

- Restore max field size to sys.maxsize, as in Python 3.13 & below
- PyCField: Split out bit/byte sizes/offsets.
- Expose CField's size/offset data to Python code
- Add generic checks for all the test structs/unions, using the newly exposed attrs

7 months agogh-131311: Extract _replace_array_elements from PyCStructUnionType_update_stginfo...
Sergey Miryanov [Mon, 24 Mar 2025 12:55:09 +0000 (17:55 +0500)] 
gh-131311: Extract _replace_array_elements from PyCStructUnionType_update_stginfo (GH-131504)

7 months agogh-128485: ensure that dlmalloc initializes itself at import time in ctypes (#131633)
Kumar Aditya [Mon, 24 Mar 2025 12:44:25 +0000 (18:14 +0530)] 
gh-128485: ensure that dlmalloc initializes itself at import time in ctypes  (#131633)

7 months agogh-131311: Fix additional memory leaks in ctypes (GH-131429)
Sergey Miryanov [Mon, 24 Mar 2025 12:42:10 +0000 (17:42 +0500)] 
gh-131311: Fix additional memory leaks in ctypes (GH-131429)

* Visit keep in StructParam_traverse
* Decref swapped in PyCSimpleType_init
* Decref ob in make_funcptrtype_dict
* Check Pointer_item result while constructing result list in Pointer_subscript

* Fix align and size naming in PyCStructUnionType_update_stginfo
  - as discussed in previous PR

7 months agogh-131645: fix ResourceWarnings in `test_asyncio.test_events` (#131646)
Thomas Grainger [Mon, 24 Mar 2025 12:38:33 +0000 (12:38 +0000)] 
gh-131645: fix ResourceWarnings in `test_asyncio.test_events` (#131646)

7 months agogh-123909: Remove obsolete note in PyType_FromMetaclass docs (GH-131506)
Petr Viktorin [Mon, 24 Mar 2025 12:06:21 +0000 (13:06 +0100)] 
gh-123909: Remove obsolete note in PyType_FromMetaclass docs (GH-131506)

Docs of the other `PyType_From*` functions link to `PyType_FromMetaclass`,
which noted that they differ for backwards compatibility reasons.
The note is no longer relevant in 3.14.
The other functions have `versionchanged` blurbs.

7 months agogh-111178: fix UBSan failures for `Modules/_testcapimodule.c` (#131614)
Bénédikt Tran [Mon, 24 Mar 2025 10:14:22 +0000 (11:14 +0100)] 
gh-111178: fix UBSan failures for `Modules/_testcapimodule.c` (#131614)

Fix UBSan failures for various classes in `Modules/_testcapimodule.c`,
remove some redundant casts and add some `Py_UNUSED()` usages.

7 months agogh-111178: fix UBSan failures for `Modules/_testcapi/{buffer,monitoring}.c` (#131613)
Bénédikt Tran [Mon, 24 Mar 2025 10:06:37 +0000 (11:06 +0100)] 
gh-111178: fix UBSan failures for `Modules/_testcapi/{buffer,monitoring}.c` (#131613)

7 months agogh-111178: fix UBSan failures for `PyBytesObject` (#131603)
Bénédikt Tran [Mon, 24 Mar 2025 10:02:09 +0000 (11:02 +0100)] 
gh-111178: fix UBSan failures for `PyBytesObject` (#131603)

7 months agogh-111178: fix UBSan failures for `Python/legacy_tracing.c` (#131611)
Bénédikt Tran [Mon, 24 Mar 2025 10:00:32 +0000 (11:00 +0100)] 
gh-111178: fix UBSan failures for `Python/legacy_tracing.c` (#131611)