Ken Jin [Fri, 27 Jun 2025 11:37:44 +0000 (19:37 +0800)]
gh-132732: Automatically constant evaluate pure operations (GH-132733)
This adds a "macro" to the optimizer DSL called "REPLACE_OPCODE_IF_EVALUATES_PURE", which allows automatically constant evaluating a bytecode body if certain inputs have no side effects upon evaluations (such as ints, strings, and floats).
Serhiy Storchaka [Fri, 27 Jun 2025 07:50:59 +0000 (10:50 +0300)]
gh-53203: Fix strptime() for %c, %x and %X formats on some locales (#135971)
* Add detection of decimal non-ASCII alt digits.
* Add support of non-decimal alt digits on locale lzh_TW.
* Accept only numbers in correct range if alt digits are known.
* Fix bug in detecting the position of the week day name on locales byn_ER and wal_ET.
* Fix support of single-digit hour on locales ar_SA and bg_BG.
* Add support for %T, %R, %r, %C, %OC.
* Prepare code to use nl_langinfo().
Tim Peters [Fri, 27 Jun 2025 04:48:05 +0000 (23:48 -0500)]
gh-135551: Change how sorting picks minimum run length (#135553)
New scheme from Stefan Pochmann for picking minimum run lengths.
By allowing them to change a little from one run to the next, it's possible to
arrange for that all merges, at all levels, strongly tend to be as evenly balanced
as possible, for randomly ordered data. Meaning the number of initial runs is a
power of 2, and all merges involve runs whose lengths differ by no more than 1.
gh-135966: Modify iOS testbed to make app_packages a site directory (#135967)
The iOS testbed now treats the app_packages folder as a site folder. This ensures it is
on the path, but also ensures any .pth files are processed on app startup.
Nathan Korth [Thu, 26 Jun 2025 22:35:45 +0000 (18:35 -0400)]
gh-135995: Fix missing char in palmos encoding (#135990)
0x8b correctly encodes to ‹, but 0x9b was mistakenly marked as a control character instead of ›.
---------
Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com> Co-authored-by: Brian Schubert <brianm.schubert@gmail.com> Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
Duane Griffin [Thu, 26 Jun 2025 14:18:32 +0000 (02:18 +1200)]
gh-91555: add warning to docs about possibility of deadlock/infinite recursion (GH-135954)
* gh-91555: add warning to docs about possibility of deadlock/infinite recursion
Attempt to clarify in the documentation that care must be taken when using
multiprocessing classes to implement logging since they have builtin internal
logging, and hence may cause deadlock/infinite recursion.
The documentation incorrectly stated that generator.close() 'raises' a
GeneratorExit exception. This was misleading because the method doesn't
raise the exception to the caller - it sends the exception internally
to the generator and returns None.
Neil Schemenauer [Wed, 25 Jun 2025 07:06:32 +0000 (00:06 -0700)]
GH-133136: Revise QSBR to reduce excess memory held (gh-135473)
The free threading build uses QSBR to delay the freeing of dictionary
keys and list arrays when the objects are accessed by multiple threads
in order to allow concurrent reads to proceed with holding the object
lock. The requests are processed in batches to reduce execution
overhead, but for large memory blocks this can lead to excess memory
usage.
Take into account the size of the memory block when deciding when to
process QSBR requests.
Also track the amount of memory being held by QSBR for mimalloc pages. Advance the write sequence if this memory exceeds a limit. Advancing the sequence will allow it to be freed more quickly.
Process the held QSBR items from the "eval breaker", rather than from `_PyMem_FreeDelayed()`. This gives a higher chance that the global read sequence has advanced enough so that items can be freed.
Emma Smith [Mon, 23 Jun 2025 10:28:05 +0000 (06:28 -0400)]
gh-134986: Catch PermissionError when trying to call perf in tests (#134987)
Using Ubuntu 24.04 on the Windows Subsystem for Linux, perf will raise a
`PermissionError` instead of `FileNotFoundError`. This commit modifies
the tests to catch that.
Kattni [Sun, 22 Jun 2025 04:51:23 +0000 (00:51 -0400)]
patchcheck: use URL paths to identify upstream remote (GH-135806)
* find defined "(fetch)" remotes with "python/cpython" in their URL
* if there is exactly one, use that remote name
* if there is one named "upstream", "origin", or "python",
use that remote (in that precedence order)
* otherwise report an error listing the defined remotes
Bénédikt Tran [Sat, 21 Jun 2025 12:32:00 +0000 (14:32 +0200)]
gh-135532: optimize calls to `PyMem_Malloc` in SHAKE digest computation (#135744)
- Add a fast path when the digest length is 0 to avoid calling useless functions.
- Directly allocate via `PyBytes_FromStringAndSize(NULL, length)` when possible.
Bénédikt Tran [Sat, 21 Jun 2025 09:43:30 +0000 (11:43 +0200)]
gh-135759: consistently reject negative sizes in SHAKE digests (#135767)
Passing a negative digest length to `_hashilb.HASHXOF.[hex]digest()` now
raises a ValueError instead of a MemoryError or a SystemError. This makes
the behavior consistent with that of `_sha3.shake_{128,256}.[hex]digest`.
Hood Chatham [Sat, 21 Jun 2025 06:06:59 +0000 (23:06 -0700)]
gh-127146: Skip test_os.test_mode for Emscripten (#135764)
Temporarily skip test_os.test_mode on Emscripten; this fails consistently
on the buildbot, but not on other test configurations. Reported as #135783
for follow up.
Eric Snow [Fri, 20 Jun 2025 20:26:32 +0000 (14:26 -0600)]
gh-135698: Fix Cross-interpreter Queue.full() With Negative/Default max_size (gh-135724)
We weren't handling non-positive maxsize values (including the default) properly
in Queue.full(). This change fixes that and adjusts an associated assert.