Commit graph

131092 commits

Author SHA1 Message Date
scoder
db0ee44b93
gh-142186: Revert the unintended value change in the PY_MONITORING_EVENT_* values from gh-146182 (gh-148955)
https://github.com/python/cpython/pull/146182 left an unintended change in the `PY_MONITORING_*` macro values. This change reverts that part to avoid a user visible impact.
2026-04-25 09:05:03 +02:00
John Belmonte
95559d2a7e
gh-108951: add TaskGroup.cancel() (#127214)
Fixes #108951

Co-authored-by: sobolevn <mail@sobolevn.me>
Co-authored-by: Andrew Svetlov <andrew.svetlov@gmail.com>
Co-authored-by: Guido van Rossum <guido@python.org>
2026-04-24 11:22:05 -07:00
Gregory P. Smith
665b7dfcfa
Improve hash() builtin docstring with caveats. (GH-125229)
Improve  `hash()` builtin docstring with caveats.

Mention its return type and that the value can be expected to change between
processes (hash randomization).

Why? The `hash` builtin gets reached for and used by a lot of people whether it
is the right tool or not. IDEs surface docstrings and people use pydoc and
`help(hash)`.
2026-04-24 16:36:46 +00:00
Hai Zhu
618b726d68
gh-146073: Add fitness/exit quality mechanism for JIT trace frontend (GH-148089)
* Replaces ad-hoc logic for ending traces with a simple inequality: `fitness < exit_quality`
* Fitness starts high and is reduced for branches, backward edges, calls and trace length
* Exit quality reflect how good a spot that instruction is to end a trace. Closing a loop is very, specializable instructions are very low and the others in between.
2026-04-24 10:37:01 +01:00
Bartosz Sławecki
448d7b96c1
gh-145239: Accept unary plus literal pattern (#148566)
Add '+' alternatives to signed_number and signed_real_number grammar
rules, mirroring how unary minus is already handled for pattern matching.
Unary plus is a no-op on numbers so the value is returned directly without
wrapping in a UnaryOp node.
2026-04-23 22:07:28 +03:00
Sam Gross
4629c2215a
gh-113956: Make intern_common thread-safe in free-threaded build (gh-148886)
Avoid racing with the owning thread's refcount operations when
immortalizing an interned string: if we don't own it and its refcount
isn't merged, intern a copy we own instead. Use atomic stores in
_Py_SetImmortalUntracked so concurrent atomic reads are race-free.
2026-04-23 14:42:57 -04:00
Hugo van Kemenade
42d645a7e8
gh-132631: Fix "I/O operation on closed file" when parsing JSON Lines file (#132632)
Co-authored-by: Brian Schubert <brianm.schubert@gmail.com>
2026-04-23 15:27:02 +00:00
Eoin Shaughnessy
435be06dd2
gh-148663: Document that calendar.IllegalMonthError inherits from both ValueError and IndexError (#148664)
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
Co-authored-by: Stan Ulbrych <stan@python.org>
2026-04-23 15:50:23 +01:00
Stan Ulbrych
0469e6d38d
gh-148735: Fix a UAF in Element.findtext() (#148738) 2026-04-23 15:48:00 +01:00
David Ellis
158dbbb97f
gh-148680: Replace internal names with type_reprs of objects in string representations of ForwardRef (#148682)
Co-authored-by: Shamil <ashm.tech@proton.me>
2026-04-23 06:22:20 -07:00
Diego Russo
9633c5239d
GH-126910: Build/link the JIT shim in the Python interpreter (#148872) 2026-04-23 12:23:18 +01:00
Kumar Aditya
29917d51ab
gh-148907: fix performance regression in PyType_GetModuleByDef on free-threading (#148908) 2026-04-23 16:42:57 +05:30
Petr Viktorin
ab41a347eb
gh-146636: Improve ABI/feature selection, add new header for it (GH-148302)
Improve ABI/feature selection, add new header for it.

Add a test that Python headers themselves don't use
Py_GIL_DISABLED in abi3t: abi3 and abi3t ought to be the
same except the _Py_OPAQUE_PYOBJECT differences.
This is done using the GCC-only poison pragma.

Co-authored-by: Victor Stinner <vstinner@python.org>
2026-04-23 11:52:13 +02:00
Nathan Goldbaum
3b9397988d
gh-148892: Drop mention of deprecated cibuildwheel option (#148893) 2026-04-23 09:30:35 +05:30
Raymond Hettinger
fbc7676df6
Speed up counting in statistics.fmean() (gh-148875) 2026-04-22 22:06:56 -05:00
Victorien
8bf99ae3a9
gh-119180: Document the format parameter in typing.get_type_hints() (#143758)
Do not mention `__annotations__` dictionaries, as this is slightly
outdated since 3.14.

Rewrite the note about possible exceptions for clarity. Also do not
mention imported type aliases, as since 3.12 aliases with the `type`
statement do not suffer from this limitation anymore.
2026-04-23 02:50:15 +00:00
John Seong
75ff1afcb6
gh-142965: Fix Concatenate documentation to reflect valid use cases (#143316)
The documentation previously stated that Concatenate is only valid
when used as the first argument to Callable, but according to PEP 612,
it can also be used when instantiating user-defined generic classes
with ParamSpec parameters.
2026-04-22 19:46:04 -07:00
Vikash Kumar
bd7352d807
gh-145194: Fix typing in re tokenizer example (#145198) 2026-04-22 19:40:10 -07:00
Pieter Eendebak
8e43f3d117
gh-145056: Add support for frozendict in dataclass asdict and astuple (#145125) 2026-04-22 19:39:08 -07:00
Shamil
be833e658a
gh-146553: Fix infinite loop in typing.get_type_hints() on circular __wrapped__ (#148595) 2026-04-22 19:31:58 -07:00
Sanjay Janardhan
79321fdce3
gh-148883: Docs: clarify grammar in Counter dictionary methods note (gh-148882) 2026-04-22 17:56:14 -05:00
Seth Larson
76b3923d68
gh-90309: Base64-encode cookie values embedded in JS 2026-04-22 19:22:31 +00:00
Sam Gross
ad3c5b7958
gh-148820: Fix _PyRawMutex use-after-free on spurious semaphore wakeup (gh-148852)
_PyRawMutex_UnlockSlow CAS-removes the waiter from the list and then
calls _PySemaphore_Wakeup, with no handshake. If _PySemaphore_Wait
returns Py_PARK_INTR, the waiter can destroy its stack-allocated
semaphore before the unlocker's Wakeup runs, causing a fatal error from
ReleaseSemaphore / sem_post.

Loop in _PyRawMutex_LockSlow until _PySemaphore_Wait returns Py_PARK_OK,
which is only signalled when a matching Wakeup has been observed.

Also include GetLastError() and the handle in the Windows fatal messages
in _PySemaphore_Init, _PySemaphore_Wait, and _PySemaphore_Wakeup to make
similar races easier to diagnose in the future.
2026-04-22 14:31:19 -04:00
Isuru Fernando
59b41c8c3b
gh-148858: Remove duplicated recipe.yaml files in Tools/pixi-packages (#148859) 2026-04-22 20:50:30 +03:00
Raymond Hettinger
b16886528e
Additional itertool recipes for running statistics (gh-148879) 2026-04-22 11:52:41 -05:00
KotlinIsland
04fd103713
gh-148207: add additional keywords to typing.TypeVarTuple (#148212) 2026-04-22 06:28:12 -07:00
Mark Shannon
f93834ff01
GH-146073: Add example script for dumping JIT traces (GH-148840) 2026-04-22 11:09:05 +01:00
Gabriele N. Tornetta
858e69eab0
gh-142186: Allow all PEP-669 events to be per-code object and disableable (GH-146182)
* Make the `PY_UNWIND` monitoring event available as a code-local
event to allow trapping on function exit events when an exception
bubbles up. This complements the PY_RETURN event by allowing to
catch any function exit event.

* Allow `PY_UNWIND`  to be `DISABLE`d; disabling it disables the event for the whole code object.

* Do the above for `PY_THROW`, `RAISE`, `EXCEPTION_HANDLED`, and `RERAISE` events.
2026-04-22 09:08:23 +01:00
cui
09233bd198
gh-146578: _zstd: Fix printf format for pledged size errors (#146576)
Use %llu instead of %ull for unsigned long long in zstd_contentsize_converter ValueError messages.
2026-04-21 12:49:44 -07:00
Rida Zouga
0b9146e90b
[Enum] Improve clarity of comparison sentence (GH-148753)
Co-authored-by: Ethan Furman <ethan@stoneleaf.us>
2026-04-21 10:17:02 -07:00
Stan Ulbrych
33e82be174
gh-148801: Fix unbound C recursion in Element.__deepcopy__() (#148802) 2026-04-21 17:20:18 +01:00
Seth Larson
1274766d3c
gh-148808: Add boundary check to asyncio.AbstractEventLoop.sock_recvf… (#148809) 2026-04-21 07:29:07 -07:00
Stan Ulbrych
d206d42834
gh-148814: Fix an issue in Emscripten README (#148752)
Correct the description of the default state of test module compilation.
2026-04-21 07:04:50 +08:00
Roman Donchenko
f6ed7c0acb
gh-108411: Make typing.IO/BinaryIO arguments positional-only (#142906)
`IO` is purported to be the type of the file objects returned by `open`.
However, all methods on those objects take positional-only arguments, while
`IO`'s methods are declared with regular arguments. As such, the file objects
cannot actually be considered to implement `IO`. The same thing applies to
`BinaryIO`.

Fix this by adjusting the definition of these ABCs to match the file objects.

This is technically a breaking change, but it is unlikely to actually break
anything:

* These methods should never be called at runtime, since they are abstract.
  Therefore, this should not cause any runtime errors.

* In typeshed these arguments are already positional-only, so this should
  not cause any errors during typechecking either.
2026-04-20 13:19:43 -07:00
ByteFlow
9a1c70c639
Fix typos in asyncio, ctypes, and importlib documentation (#148747) 2026-04-20 12:22:37 -07:00
Uwe L. Korn
5a3f479601
gh-138451: Support custom LLVM installation path (#138452)
Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
Co-authored-by: Steve Dower <steve.dower@microsoft.com>
Co-authored-by: Savannah Ostrowski <savannah@python.org>
2026-04-20 16:45:53 +00:00
Stan Ulbrych
3fd61b74de
Use soft-deprecated in more places (#148769) 2026-04-20 17:00:35 +01:00
Manoj K M
983c7462d6
Docs: Fix some typos in calendar.rst (GH-148756) 2026-04-20 14:37:12 +00:00
Régis Desgroppes
5c5dae0282
gh-148644: Propagate the PGO job exit code in PCbuild/build.bat (GH-148645) 2026-04-20 15:18:10 +01:00
AraHaan
789120e826
gh-148790: Eliminate redundant call to _PyRuntime_Initialize in Py_InitializeEx (GH-121628) 2026-04-20 10:01:06 -04:00
Filipe Laíns
513db72110
GH-145278: also filter mmap2 in strace_helper.filter_memory (GH-148648)
Signed-off-by: Filipe Laíns <lains@riseup.net>
2026-04-20 15:41:10 +02:00
Donghee Na
22c8590e40
gh-148718: Fix Py_STACKREF_DEBUG build by defining macros (#148719) 2026-04-20 21:55:03 +09:00
Serhiy Storchaka
bfe6f9f590
gh-123853: Update locale.windows_locale (GH-123901)
Update the table of Windows language code identifiers (LCIDs) to
protocol version 16.0 (2024-04-23).
2026-04-20 11:47:37 +03:00
Stan Ulbrych
a00b24ec68
gh-148788: Update Emscripten example post move to Platforms dir (#148761)
Update Emscripten example post move to Platforms dir.
2026-04-20 10:17:50 +08:00
Matthew Davis
e50acef0b2
gh-148763: Fix paramter name in multiprocessing.connection.send_bytes/recv_bytes_into docs (GH-126603)
Doc: Fix buf argument name in multiprocessing connection send_bytes
2026-04-19 17:05:50 -07:00
partev
82767780f8
gh-148779: Update Briefcase link in android.rst documentation (#148777)
Use canonical beeware.org URL for link to Briefcase.
2026-04-20 05:44:08 +08:00
Hugo van Kemenade
a8c9aa924b
gh-133879: Copyedit "What's new in Python 3.15" (#148686) 2026-04-19 21:42:23 +03:00
Sam Gross
ad7d3616c6
gh-121946: Use clang-20 for TSan build (#148570) 2026-04-19 15:13:47 +03:00
Hugo van Kemenade
9e23652230
Prevent GitHub's web conflict editor from converting LF to CRLF (#148739) 2026-04-19 12:21:17 +03:00
Daniel Hollas
4b33308137
gh-148406: Fix annotations of _colorize.FancyCompleter (#148408)
Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
2026-04-18 21:51:58 +03:00