Commit graph

30836 commits

Author SHA1 Message Date
Petr Viktorin
9d41e2a534
gh-111264: Add a note about untrusted input to tomllib docs (GH-146209)
Co-authored-by: Stan Ulbrych <stan@python.org>
2026-04-30 16:33:13 +02:00
Eric Froemling
7686abe063
gh-149085: Add max_threads keyword to faulthandler.dump_traceback() (GH-149106)
Add a keyword-only `max_threads` argument to `dump_traceback()` and
`dump_traceback_later()`, defaulting to 100 to preserve existing
behavior. Allows server processes with many worker threads to dump
beyond the historical 100-thread cap (previously a hardcoded
`MAX_NTHREADS = 100` in `Python/traceback.c`).

The cap matters in practice: tstates are prepended to the
PyInterpreterState linked list, so the dump walks newest-first. With
more than 100 threads alive, the main thread (oldest, at the tail) is
silently elided from watchdog dumps -- exactly the thread that's
usually wanted.

The hardcoded value is moved to a new internal macro
`_Py_TRACEBACK_MAX_NTHREADS` in `pycore_traceback.h` so the in-tree
fatal-signal callers all reference one source of truth.
2026-04-30 09:27:57 -04:00
Petr Viktorin
a94c7900be
Revert pylock.toml change to make MSI builds pass (#149175)
GH-149058 made MSI installer tests fail. GHA didn't catch this because MSI-related files weren't changed.

This reverts the build.bat change from commit 40dc61a0e0.

Also: a README style nitpick to trigger CI.
2026-04-30 10:30:34 +02:00
Tian Gao
234c12c0fc
GH-145378: Use PyREPL as the default input console for pdb (#145379) 2026-04-29 22:55:09 -07:00
Hugo van Kemenade
8851a06e6e
gh-149026: Add colour to pickletools CLI output (#149027)
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
2026-04-29 18:33:05 +03:00
Stelar
2674c322c6
gh-149119: docs: mention that sentinel does not support subclassing (#149120)
Add note about sentinel objects not supporting subclassing

Clarify that sentinel objects do not support subclassing.
2026-04-28 16:50:53 -07:00
Hugo van Kemenade
40dc61a0e0
Build docs from pylock.toml (#149058) 2026-04-28 21:45:38 +03:00
John Belmonte
8a8d737be2
gh-108951: document addition of TaskGroup.cancel() (#149031)
Co-authored-by: Alex Grönholm <alex.gronholm@nextday.fi>
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
2026-04-28 09:45:55 -07:00
Gregory P. Smith
9a57179d74
GH-83065: Fix import deadlock by implementing hierarchical module locking (GH-137196)
Make _find_and_load() acquire the module locks for the full
dotted-name chain (parent before child) when loading a nested module, so
both threads contend on the same first lock and serialise instead of
deadlocking.

When acquiring a parent's lock would itself deadlock with another thread
that is loading that parent (cross-package circular imports), the parent's
lock is skipped and the partially-initialised parent is accepted -- the
same policy _lock_unlock_module() already applies on the existing code
path -- so concurrent circular imports that worked before continue to work.
2026-04-28 01:06:23 -07:00
Alex Grönholm
29251396a9
gh-125862: Keep ContextDecorator open across generator/coroutine execution (GH-136212)
ContextDecorator and AsyncContextDecorator (and therefore @contextmanager
and @asynccontextmanager used as decorators) now detect generator,
coroutine, and asynchronous generator functions and emit a wrapper of the
matching kind, so the context manager spans iteration or await rather than
just the call that constructs the lazy object.  Wrapped generators are
explicitly closed when iteration ends.

For asynchronous generator wrappers, values passed via asend() and
exceptions via athrow() are not forwarded to the wrapped generator.

AsyncContextDecorator now also accepts synchronous functions and
generators, returning an asynchronous wrapper; ContextDecorator remains
the recommended choice for those.

inspect.isgeneratorfunction(), iscoroutinefunction(), and
isasyncgenfunction() now return True for the decorated result when the
input is of that kind.

---------

Co-authored-by: Gregory P. Smith <greg@krypto.org>
2026-04-28 05:26:38 +00:00
ByteFlow
c8799f137a
gh-149035: Modernize legacy Python patterns in Doc/tutorial/stdlib2.rst (#149036)
Co-authored-by: Copilot <copilot@github.com>
2026-04-28 08:08:23 +03:00
Brian Schubert
d2f506ae07
gh-137600: Promote ast node constructor deprecation warnings to errors (#137601)
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
2026-04-28 02:51:06 +00:00
Jelle Zijlstra
29a92abb60
gh-148829: Implement PEP 661 (#148831)
Co-authored-by: Victorien <65306057+Viicos@users.noreply.github.com>
Co-authored-by: Pieter Eendebak <pieter.eendebak@gmail.com>
Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
2026-04-27 19:28:30 -07:00
Serhiy Storchaka
3e5a3cb2bd
gh-148529: Minor improvements of the struct module documentation (GH-148565)
* Document that 's' and 'p' accept bytes and bytearray.
* Fix some footnotes.
* Clarify that "string" is a byte string.
* Fix the module docstring.
2026-04-27 21:30:48 +03:00
Salvo 'LtWorf' Tomaselli
f4a726da40
GH-135357: Add socket.SO_PASSRIGHTS constant (#135355)
Constant added to Linux 6.16. See the LWN article:
https://lwn.net/Articles/1023085/

Co-authored-by: Brian Schubert <brianm.schubert@gmail.com>
Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
Co-authored-by: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com>
Co-authored-by: Victor Stinner <vstinner@python.org>
Co-authored-by: Peter Bierma <zintensitydev@gmail.com>
2026-04-27 13:12:34 +00:00
Micah Najacht
804c213c89
gh-82665 Mention that HTMLParser.handle_starttag value can be None (#134312)
* Specify boolean attribute behavior in parser

* Tweak wording and example

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
Co-authored-by: Ezio Melotti <ezio.melotti@gmail.com>

* Fix backticks

---------

Co-authored-by: Ezio Melotti <ezio.melotti@gmail.com>
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2026-04-27 08:27:05 +02:00
Gregory P. Smith
f27e91e372
Document that multiprocessing treats local same-user processes as trusted (GH-149001)
Clarify in the Authentication keys section that the authkey handshake
covers Listener/Client (addressable endpoints) only, not the anonymous
pipes behind Pipe() and Queue, and that isolation between same-user
processes must be arranged at the OS level.
2026-04-26 18:42:13 -07:00
Hugo van Kemenade
1e7dfbce93
gh-148991: Add colour to tokenize CLI output (#148992)
Co-authored-by: Stan Ulbrych <stan@python.org>
2026-04-26 22:14:33 +03:00
Stan Ulbrych
6d4ca16f47
gh-148981: Add color parameter to ast.dump (#148982)
And turn on color for the `ast` module CLI.
2026-04-26 10:15:54 +01:00
Gregory P. Smith
c5fcdb4a9b
gh-146311: Reject non-canonical padding bits in base32, 64, & 85 decoding (GH-146312)
Add `canonical=False` keyword argument to `a2b_base64`, `a2b_base32`, `a2b_base85`, and `a2b_ascii85` (and their `base64` module wrappers). When `canonical=True`, non-canonical encodings are rejected per [RFC 4648 section 3.5](https://datatracker.ietf.org/doc/html/rfc4648.html#section-3.5).

This is independent of `strict_mode`.

For base85/ascii85, the check also rejects single-character final groups (never produced by a conforming encoder) and verifies partial group padding matches what the encoder would produce.

Co-authored-by: Serhiy Storchaka via lots of great code review!
2026-04-25 16:02:51 -07:00
Mai Giménez
a2fa63b787
gh-140727: Update tachyon logo (#148965) 2026-04-25 22:27:11 +01:00
sobolevn
85d3bcd4f3
gh-134690: Removed deprecated codetype.co_lnotab (#134691) 2026-04-25 19:13:48 +03:00
Bartosz Sławecki
9dab866f9c
gh-148588: Document __lazy_modules__ (#148590) 2026-04-25 15:23:40 +01: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
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
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
Nathan Goldbaum
3b9397988d
gh-148892: Drop mention of deprecated cibuildwheel option (#148893) 2026-04-23 09:30:35 +05:30
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
Sanjay Janardhan
79321fdce3
gh-148883: Docs: clarify grammar in Counter dictionary methods note (gh-148882) 2026-04-22 17:56:14 -05: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
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
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
ByteFlow
9a1c70c639
Fix typos in asyncio, ctypes, and importlib documentation (#148747) 2026-04-20 12:22:37 -07: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
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
Hugo van Kemenade
e9bbf8617d
Add a new Sphinx soft-deprecated directive (#148630)
Co-authored-by: Stan Ulbrych <stan@python.org>
2026-04-18 11:37:54 +03:00
Jelle Zijlstra
92164dc917
gh-148639: Implement PEP 800 (typing.disjoint_base) (#148640)
Co-authored-by: Victorien <65306057+Viicos@users.noreply.github.com>
Co-authored-by: Petr Viktorin <encukou@gmail.com>
2026-04-17 19:20:41 -07:00
Xuwz
a86234ea85
gh-148683: Doc: fix misplaced pprint entries in What's New 3.15 (#148685)
Doc: fix misplaced pprint entries in What's New 3.15
2026-04-17 17:13:41 +03:00
Dino Viehland
c0af5c024b
gh-146031: Allow keeping specialization enabled when specifying eval frame function (#146032)
Allow keeping specialization enabled when specifying eval frame function
2026-04-16 09:44:26 -07:00
Petr Viktorin
0fcf2b72d3
gh-146636: PEP 803: Reference documentation (GH-148013)
Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
2026-04-16 14:17:44 +02:00
Havmaagen
9d38143088
Docs: Fix typos and a comment in enum.rst (#148156) 2026-04-16 11:23:29 +05:30
Steve Dower
54607eec34
Add PyManager documentation for index signatures (GH-148631) 2026-04-15 22:48:14 +01:00
Hugo van Kemenade
eb2f634b83
gh-148100: Soft deprecate re.match and re.Pattern.match in favour of prefixmatch (#148101) 2026-04-15 23:09:47 +03:00