]> git.ipfire.org Git - thirdparty/Python/cpython.git/log
thirdparty/Python/cpython.git
42 min agogh-148954: Escape methodname in xmlrpc.client.dumps() to prevent XML injection (GH... main
Sanyam Kumat [Sat, 6 Jun 2026 21:38:15 +0000 (03:08 +0530)] 
gh-148954: Escape methodname in xmlrpc.client.dumps() to prevent XML injection (GH-148968)

5 hours agogh-50948: IDLE: Warn if saving a file will overwrite a newer version (GH-17578)
Zackery Spytz [Sat, 6 Jun 2026 17:14:45 +0000 (10:14 -0700)] 
gh-50948: IDLE: Warn if saving a file will overwrite a newer version (GH-17578)

Co-authored-by: Guilherme Polo <ggpolo@gmail.com>
Co-authored-by: Priya Pappachan <priyapappachan010@gmail.com>
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
5 hours agogh-150411: fix `gc_generation.count` race in free-threading (#150413)
Edward Xu [Sat, 6 Jun 2026 17:03:04 +0000 (01:03 +0800)] 
gh-150411: fix `gc_generation.count` race in free-threading (#150413)

9 hours agogh-149083: Use sentinel for urllib.parse._UNSPECIFIED (#149612)
Jelle Zijlstra [Sat, 6 Jun 2026 12:47:33 +0000 (05:47 -0700)] 
gh-149083: Use sentinel for urllib.parse._UNSPECIFIED (#149612)

This was added in 3.15; let's use a real sentinel instead of an ad-hoc list object.

10 hours agoDelete mention encoding and errors for importlib.resources.path() (GH-143111)
Alexander Shadchin [Sat, 6 Jun 2026 11:52:01 +0000 (14:52 +0300)] 
Delete mention encoding and errors for importlib.resources.path() (GH-143111)

10 hours agoDoc: fix order of PyLong_FromUnsignedLongLong (#150937)
Inada Naoki [Sat, 6 Jun 2026 11:37:49 +0000 (20:37 +0900)] 
Doc: fix order of PyLong_FromUnsignedLongLong (#150937)

12 hours agogh-150534: Add C23 half-turn trigonometric *pi functions (GH-150555)
Jeff Epler [Sat, 6 Jun 2026 10:19:45 +0000 (03:19 -0700)] 
gh-150534: Add C23 half-turn trigonometric *pi functions (GH-150555)

Add the the following functions to the math module:
acospi, asinpi, atanpi, atan2pi, cospi, sinpi, tanpi.

12 hours agogh-149835: Use realpath() instead of abspath() in shutil.move() (GH-149986)
Thomas Kowalski [Sat, 6 Jun 2026 10:04:23 +0000 (12:04 +0200)] 
gh-149835: Use realpath() instead of abspath() in shutil.move() (GH-149986)

13 hours agogh-84649: Use statx() in TimedRotatingFileHandler if available (ПР-150968)
Serhiy Storchaka [Sat, 6 Jun 2026 08:49:07 +0000 (11:49 +0300)] 
gh-84649: Use statx() in TimedRotatingFileHandler if available (ПР-150968)

This allows to support rotation based on the file birth time on Linux.

13 hours agogh-150889: Improve performance of unicodedata.normalize() (GH-150890)
Pieter Eendebak [Sat, 6 Jun 2026 08:34:33 +0000 (10:34 +0200)] 
gh-150889:  Improve performance of unicodedata.normalize() (GH-150890)

Scan the nfc_first/nfc_last reindex tables comparing only .start, range-check
the candidate once, and terminate on a sentinel above every codepoint, so each
entry costs a single comparison. ~2x faster on non-Latin and combining-heavy
NFC/NFKC input; no new data tables.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
15 hours agogh-148832: Use `-icf=0` in BOLT_APPLY_FLAGS (gh-148833)
Shamil [Sat, 6 Jun 2026 07:19:49 +0000 (10:19 +0300)] 
gh-148832: Use `-icf=0` in BOLT_APPLY_FLAGS (gh-148833)

19 hours agogh-150662: Stop unbounded memory growth in Tachyon `--gecko` collector (#150845)
Maurycy Pawłowski-Wieroński [Sat, 6 Jun 2026 02:27:41 +0000 (04:27 +0200)] 
gh-150662: Stop unbounded memory growth in Tachyon `--gecko` collector (#150845)

20 hours agogh-150207: Raise MemoryError on tokenizer allocation failure instead of crashing...
Grant Herman [Sat, 6 Jun 2026 01:58:35 +0000 (21:58 -0400)] 
gh-150207: Raise MemoryError on tokenizer allocation failure instead of crashing (#150275)

23 hours agoUse `time.monotonic` in OrderedDict LRU cache example (#150986)
Ilya Nikolaev [Fri, 5 Jun 2026 22:42:59 +0000 (01:42 +0300)] 
Use `time.monotonic` in OrderedDict LRU cache example (#150986)

29 hours agogh-110631: Fix wrong blocks indentation in difflib.rst (GH-110885)
Ezio Melotti [Fri, 5 Jun 2026 17:02:10 +0000 (01:02 +0800)] 
gh-110631: Fix wrong blocks indentation in difflib.rst (GH-110885)

30 hours agogh-150436: Check returncode in Win32ProcessTestCase (#150972)
Victor Stinner [Fri, 5 Jun 2026 15:24:46 +0000 (17:24 +0200)] 
gh-150436: Check returncode in Win32ProcessTestCase (#150972)

30 hours agogh-149977: Fix extra output of `-m test test_lazy_import`, again (#150965)
sobolevn [Fri, 5 Jun 2026 15:21:10 +0000 (18:21 +0300)] 
gh-149977: Fix extra output of `-m test test_lazy_import`, again (#150965)

31 hours agogh-150818: Wire logger parent before publishing it in getLogger() (GH-150941)
Bernát Gábor [Fri, 5 Jun 2026 15:00:56 +0000 (08:00 -0700)] 
gh-150818: Wire logger parent before publishing it in getLogger() (GH-150941)

32 hours agogh-146527: Fix memory leak in _PyGC_Fini() (#150969)
Victor Stinner [Fri, 5 Jun 2026 13:43:05 +0000 (15:43 +0200)] 
gh-146527: Fix memory leak in _PyGC_Fini() (#150969)

Free generation_stats allocated by _PyGC_Init().

Fix Python/gc.c: Python/gc_free_threading.c was already fixed.

33 hours agogh-53144: Improve charset support in the email package (GH-149942)
Serhiy Storchaka [Fri, 5 Jun 2026 12:53:59 +0000 (15:53 +0300)] 
gh-53144: Improve charset support in the email package (GH-149942)

Defer to the codecs module for all aliases.
Use MIME/IANA names for all IANA registered charsets.
Fix email.contentmanager.set_text_content().

33 hours agogh-84649: Fix unstable test_rollover_based_on_st_birthtime_only (GH-150954)
Serhiy Storchaka [Fri, 5 Jun 2026 12:41:51 +0000 (15:41 +0300)] 
gh-84649: Fix unstable test_rollover_based_on_st_birthtime_only (GH-150954)

34 hours agogh-150907: Fix dynamic_annotations.h when built with C++ and Valgrind (#150914)
Victor Stinner [Fri, 5 Jun 2026 12:11:46 +0000 (14:11 +0200)] 
gh-150907: Fix dynamic_annotations.h when built with C++ and Valgrind (#150914)

Add extern "C++" scope for the C++ template.

Fix test_cppext when Python is built with --with-valgrind.

34 hours agogh-149891: Add more encoding aliases (GH-149892)
Serhiy Storchaka [Fri, 5 Jun 2026 12:08:04 +0000 (15:08 +0300)] 
gh-149891: Add more encoding aliases (GH-149892)

Support all aliases officially registered in IANA, except
Extended_UNIX_Code_Packed_Format_for_Japanese.

New names:
KSC_5601, KS_C_5601-1989, iso-ir-149, GB_2312-80, windows-936, mac,
CCSID00858, CCSID01140, and a number of "cs"-prefixed names.

Fix csHPRoman8, which was not normalized.

34 hours agogh-129011: Update docs for Raw I/O read, readinto, and write (#135328)
Cody Maloney [Fri, 5 Jun 2026 12:00:59 +0000 (05:00 -0700)] 
gh-129011: Update docs for Raw I/O read, readinto, and write (#135328)

Update `RawIOBase` and `FileIO` documentation to match implementation
behavior around `.read`, `.readinto`, `.readall` and `.write`.

In particular:

 - They may make more than one system call (PEP-475)
 - Add warnings if `.write()` requires a wrapping retry loop (see: gh-126606)
    - "Raw I/O" `.write`` may not write all bytes
    - `buffering=0` example results in a "Raw I/O"

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
Co-authored-by: Victor Stinner <vstinner@python.org>
38 hours agogh-150899: Do not reset custom `-Xlazy_imports` mode in `test_lazy_imports` (#150900)
sobolevn [Fri, 5 Jun 2026 08:03:57 +0000 (11:03 +0300)] 
gh-150899: Do not reset custom `-Xlazy_imports` mode in `test_lazy_imports` (#150900)

38 hours agogh-62825: Fix encoding aliases "KS_C_5601-1987", "KS X 1001", etc (GH-150933)
Serhiy Storchaka [Fri, 5 Jun 2026 07:58:20 +0000 (10:58 +0300)] 
gh-62825: Fix encoding aliases "KS_C_5601-1987", "KS X 1001", etc (GH-150933)

They are now aliases of CP949 instead of EUC-KR.

40 hours agogh-145177: Bump emscripten version to 4.0.19 (#150926)
Hood Chatham [Fri, 5 Jun 2026 05:59:43 +0000 (22:59 -0700)] 
gh-145177: Bump emscripten version to 4.0.19 (#150926)

Bumpts the emscripten version to 4.0.19.

2 days agoAdd shebang documentation for PyManager 26.3b1 (GH-150931)
Steve Dower [Thu, 4 Jun 2026 20:37:18 +0000 (21:37 +0100)] 
Add shebang documentation for PyManager 26.3b1 (GH-150931)

2 days agogh-150886: Remove unused importlib._bootstrap._object_name (#150884)
Bernát Gábor [Thu, 4 Jun 2026 20:08:58 +0000 (13:08 -0700)] 
gh-150886: Remove unused importlib._bootstrap._object_name (#150884)

Introduced in GH-23469 (bpo-26131, "Deprecate usage of load_module()")
to render an object's qualified name inside the load_module()
deprecation warnings.

Orphaned by gh-142205 (GH-97850, "Remove all uses and definitions of
load_module() from importlib"), which deleted the warning-building call
sites f"{_object_name(spec.loader)}.exec_module() not found; ..." and
left the helper with no caller.

A word-boundary search across Lib, Modules, Python, Objects and Include
finds zero references outside its own definition, and a GitHub code
search finds no downstream importers. The frozen importlib was
regenerated; importlib._bootstrap._object_name no longer exists at
runtime and the full test_importlib suite passes.

2 days agogh-150817: Speed up Flag bitwise operations (GH-150824)
Bernát Gábor [Thu, 4 Jun 2026 19:58:20 +0000 (12:58 -0700)] 
gh-150817: Speed up Flag bitwise operations (GH-150824)

Flag.__or__, __and__ and __xor__ walked both operands on every call to reject
None values. Run that scan only when one of the operand values is actually
None, so valid combinations skip it. The TypeError and its message are
unchanged for the invalid cases.

2 days agogh-150818: Speed up logging.getLogger() for existing loggers (GH-150825)
Bernát Gábor [Thu, 4 Jun 2026 16:15:12 +0000 (09:15 -0700)] 
gh-150818: Speed up logging.getLogger() for existing loggers (GH-150825)

2 days agoGH-148960: Ensure that asserts are ignored if `NDEBUG` is set (#150916)
Mark Shannon [Thu, 4 Jun 2026 14:11:33 +0000 (15:11 +0100)] 
GH-148960: Ensure that asserts are ignored if `NDEBUG` is set (#150916)

2 days agogh-84649: Make TimedRotatingFileHandler use CTIME instead of MTIME (GH-24660)
Ivan Marton [Thu, 4 Jun 2026 13:50:33 +0000 (15:50 +0200)] 
gh-84649: Make TimedRotatingFileHandler use CTIME instead of MTIME (GH-24660)

The TimedRotatingFileHandler previously only used st_mtime attribute of the
log file to detect whether it has to be rotate yet or not. In cases when the
file is changed within the rotatation period the st_mtime is also updated
to the current time and the rotation never happens.

It's more appropriate to check the file creation time (st_ctime) instead.
Whenever available, the more appropriate st_birthtime will be in use. (This
feature is available on FreeBSD, MacOS and Windows at the moment.) If
the st_mtime would be newer than st_ctime (e.g.: because the inode
related to the file has been changed without any file content
modification), then the earliest attribute will be used.

2 days agogh-150913: Fix sqlite3.Blob validation for empty slice assignment (GH-150915)
Jiseok CHOI [Thu, 4 Jun 2026 13:41:47 +0000 (22:41 +0900)] 
gh-150913: Fix sqlite3.Blob validation for empty slice assignment (GH-150915)

ass_subscript_slice() returned early when the computed slice length
was zero, bypassing validation performed for non-empty slices.

2 days agogh-150750: Fix a race condition in `deque.index` with free-threading (#150779)
sobolevn [Thu, 4 Jun 2026 13:31:31 +0000 (16:31 +0300)] 
gh-150750: Fix a race condition in `deque.index` with free-threading (#150779)

2 days agogh-106318: Add doctest role and a 'See also' to the `str.split()` docs (#144367)
Adorilson Bezerra [Thu, 4 Jun 2026 11:39:14 +0000 (12:39 +0100)] 
gh-106318: Add doctest role and a 'See also' to the `str.split()` docs (#144367)

2 days agobpo-38131: Improve messages when generating AST nodes from objects with wrong field...
Batuhan Taskaya [Thu, 4 Jun 2026 10:58:51 +0000 (13:58 +0300)] 
bpo-38131: Improve messages when generating AST nodes from objects with wrong field values (GH-17715)

2 days agoFix 2 broken links in documentation (#150892)
Miro Hrončok [Thu, 4 Jun 2026 09:42:06 +0000 (11:42 +0200)] 
Fix 2 broken links in documentation (#150892)

Co-authored-by: Stan Ulbrych <stan@python.org>
2 days agogh-119670: Add `force` keyword only argument to `shlex.quote` (#148846)
jb2170 [Thu, 4 Jun 2026 09:06:02 +0000 (10:06 +0100)] 
gh-119670: Add `force` keyword only argument to `shlex.quote` (#148846)

There are propositions to add a single-quote-double-quote switch
(gh-90630), so to avoid hiccups of people passing `force` as a
positional and it being used for the single-double switch, we make
kwargs kwargs-only.

Co-authored-by: Bartosz Sławecki <bartosz@ilikepython.com>
2 days agoManpage formatting tweaks & lint (GH-132338)
Stefano Rivera [Thu, 4 Jun 2026 07:35:04 +0000 (00:35 -0700)] 
Manpage formatting tweaks & lint (GH-132338)

Following on from GH-132291 this is the second part of the patch from https://bugs.debian.org/1101406

This tweaks the formatting of a few bits of the manpage.

2 days agogh-145177: Fix Emscripten help text (#150874)
Hood Chatham [Thu, 4 Jun 2026 00:00:51 +0000 (17:00 -0700)] 
gh-145177: Fix Emscripten help text (#150874)

Removes some stray commas in help text.

3 days agogh-150032: Tidy up 3.15 pending removals (#149594)
Stan Ulbrych [Wed, 3 Jun 2026 14:29:13 +0000 (15:29 +0100)] 
gh-150032: Tidy up 3.15 pending removals (#149594)

Co-authored-by: Savannah Ostrowski <savannah@python.org>
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
Co-authored-by: Brett Cannon <brett@python.org>
3 days agoDocs: Replace hardcoded `SOURCE_URI` with `patchlevel` check (#150850)
Hugo van Kemenade [Wed, 3 Jun 2026 13:37:09 +0000 (16:37 +0300)] 
Docs: Replace hardcoded `SOURCE_URI` with `patchlevel` check (#150850)

3 days agogh-132467: Document and test that generic aliases are not classes (#133504)
Abduaziz π [Wed, 3 Jun 2026 13:35:25 +0000 (18:35 +0500)] 
gh-132467: Document and test that generic aliases are not classes (#133504)

Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
3 days agoCorrect Stable ABI documentation for METH_FASTCALL (GH-149593)
da-woods [Wed, 3 Jun 2026 13:20:35 +0000 (14:20 +0100)] 
Correct Stable ABI documentation for METH_FASTCALL (GH-149593)

* Correct Stable ABI documentation for METH_FASTCALL

The current documentation says:

>
> METH_FASTCALL
>    Part of the Stable ABI since version 3.7.
>
> [...]
>
>   Added in version 3.7.
>
>    Changed in version 3.10: METH_FASTCALL is now part of the stable ABI.

so is contradictory about when it was added to the Stable ABI.  Looking at the header it seems like 3.10 is right.

3 days agogh-105812: Make use of the Sphinx `deco` role in documentation (#139598)
Victorien [Wed, 3 Jun 2026 13:14:47 +0000 (15:14 +0200)] 
gh-105812: Make use of the Sphinx `deco` role in documentation (#139598)

3 days agogh-141004: Document unstable perf map functions in `ceval.h` (GH-143492)
Yashraj [Wed, 3 Jun 2026 12:36:25 +0000 (18:06 +0530)] 
gh-141004: Document unstable perf map functions in `ceval.h` (GH-143492)

3 days agoFix a typo in `SSLSocket` docs (GH-150839)
Robsdedude [Wed, 3 Jun 2026 12:18:06 +0000 (14:18 +0200)] 
Fix a typo in `SSLSocket` docs (GH-150839)

3 days agogh-146636: Add Free-threaded Stable ABI migration guide (GH-150580)
Petr Viktorin [Wed, 3 Jun 2026 12:02:36 +0000 (14:02 +0200)] 
gh-146636: Add Free-threaded Stable ABI migration guide (GH-150580)

Co-authored-by: Charlie Lin <tuug@gmx.us>
Co-authored-by: da-woods <dw-git@d-woods.co.uk>
Co-authored-by: Stan Ulbrych <stan@python.org>
Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
3 days agogh-148613: Fix race in `gc_set_threshold` and `gc_get_threshold` (#150356)
Edward Xu [Wed, 3 Jun 2026 11:28:26 +0000 (19:28 +0800)] 
gh-148613: Fix race in `gc_set_threshold` and `gc_get_threshold` (#150356)

3 days agogh-150723: Fix perf jitdump files on macOS (#150728)
Nazım Can Altınova [Wed, 3 Jun 2026 00:15:34 +0000 (02:15 +0200)] 
gh-150723: Fix perf jitdump files on macOS (#150728)

The perf jitdump format defines the thread id field of the JR_CODE_LOAD
record as a 32-bit value, but on macOS it was declared as a uint64_t
(since pthread_threadid_np() returns a uint64_t). Those extra 8 bytes
plus alignment padding shifted every following field, so parsers reading
the file by the spec misread code_size as the code address and failed to
resolve any Python frames.

Declare thread_id as uint32_t on all platforms and truncate the macOS
thread id when writing the record. The value is only informational.
Symbols are resolved by address, and not thread ids so truncation is
safe here.

* Use mach_absolute_time for macOS jitdump timestamps

On macOS the jitdump file is consumed by profilers such as samply, which
timestamp their samples using mach_absolute_time(). The jitdump events were
stamped with clock_gettime(CLOCK_MONOTONIC), a different clock domain that
keeps advancing while the system is asleep, so the JIT code mappings could be
off by days relative to the samples and no Python frame would resolve. Stamp
jitdump events with mach_absolute_time() on macOS so they share the sampler's
clock domain. Linux continues to use CLOCK_MONOTONIC to stay aligned with perf.

Exercise the -Xperf_jit (jitdump) backend through samply and assert that
Python frames resolve, exercising the binary jitdump path end to end.
Skipped when samply is not installed.

4 days agogh-91099: fix[imaplib]: call Exception with string instance (#31823)
Florian Best [Tue, 2 Jun 2026 20:42:04 +0000 (22:42 +0200)] 
gh-91099: fix[imaplib]: call Exception with string instance (#31823)

* bpo-46943: fix[imaplib]: call Exception with string instance

Adjust the behavior of 'login' to be similar to `authenticate()`,
where self.error is called with a str() instance.

Co-authored-by: Oleg Iarygin <oleg@arhadthedev.net>
4 days agogh-150319: Replace all documentation which says "See PEP 585" (#150325)
Stephen Rosen [Tue, 2 Jun 2026 20:13:34 +0000 (15:13 -0500)] 
gh-150319: Replace all documentation which says "See PEP 585" (#150325)

* Replace all documentation which says "See PEP 585"

The following classes in the stdlib get simple updates:

- array.array
- asyncio.Future
- asyncio.Task
- collections.defaultdict
- collections.deque
- contextvars.ContextVar
- contextvars.Token
- ctypes.Array
- os.DirEntry
- re.Match
- re.Pattern
- string.templatelib.Interpolation
- string.templatelib.Template
- types.MappingProxyType
- queue.SimpleQueue
- weakref.ref

The following classes are documented publicly as functions, and are
therefore updated internally (`__class_getitem__.__doc__`) but not in the
public docs:

- functools.partial
- itertools.chain

The following builtin types have updates to `__class_getitem__.__doc__`
but not to any documentation pages:

- BaseExceptionGroup
- coroutines (from generators)
- dict
- enumerate
- frozendict
- frozenset
- generators (and async generators)
- list
- memoryview
- set
- slice
- tuple

Special cases:

- union objects are now documented as "supporting class-level []",
  rather than anything to do with generics.

- Templates might be generic over a single type (union, in theory) or
  over a TypeVarTuple. As this is not currently fully settled, it is
  marked with a comment and a mild hint that it is a single type is used
  (namely, "type" is singular rather than "types", plural)

* Apply suggestions from code review

Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
* Correct several class getitem docs

And expand the text for tuples.

Co-authored-by: Jelle Zijlstra <906600+JelleZijlstra@users.noreply.github.com>
* Add notes on generic typing of builtins

* Fix typo in tuple.__class_getitem__ docstring

* Typo fix: malformed refs

Fix `generic` links which weren't marked as `:ref:`.

* Strike unnecessary docs on generic-ness

Co-authored-by: Jelle Zijlstra <906600+JelleZijlstra@users.noreply.github.com>
* Apply suggestions from code review

These are applied at both the originally indicated locations and in the
corresponding docstring definitions.

Co-authored-by: Alex Waygood <66076021+AlexWaygood@users.noreply.github.com>
* Update Doc/library/re.rst

Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
* Update Objects/enumobject.c

Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
* Remove tuple generic doc in 'stdtypes' page

This is covered in more detail in the cross-linked typing documentation.
The other copy of this documentation -- in the docstring for
`tuple.__class_getitem__` -- is left in place.

* Fix whitespace around new doc of generics

Per review, do not introduce or remove whitespace such that section
breaks are altered by the introduction of doc on various generic types.

In most cases, this is a removal of an extra line.

In one case (Arrays), it is the reintroduction of a line.

Additionally, two other minor fixes are included:
- incorrect indent on 'defaultdicts'
- make `mappingproxy.__class_getitem__.__doc__` consistent with other
  mapping type generic docs

Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
* Move placement of memoryview generic note

Previous placement was at the end of the main docstring, which is
consistent with other types but places it after a section on various
methods (which makes it read somewhat inconsistently). Moving it up
helps resolve.

Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
* Ensure sphinxdoc does not start sentences lowercase

Lowercase class names at the start of sentences are marked out with the
`class` role. In the case of `deque`, documentation already refers to
these as `Deques`, so this form is preferred.

* Apply suggestions from code review

Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
* Fix line endings and wrap more tightly

Line endings fixed by pre-commit ; also re-wrapped the MappingProxyType
text which was too long.

* Use 'ContextVars' style in sphinx doc

---------

Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
Co-authored-by: Jelle Zijlstra <906600+JelleZijlstra@users.noreply.github.com>
Co-authored-by: Alex Waygood <66076021+AlexWaygood@users.noreply.github.com>
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
4 days agoFix description of the function parameter of shutil.register_archive_format() (GH...
Brian Schubert [Tue, 2 Jun 2026 19:12:36 +0000 (15:12 -0400)] 
Fix description of the function parameter of shutil.register_archive_format() (GH-145087)

4 days agoAdd link to new security policy (#150800)
Seth Larson [Tue, 2 Jun 2026 18:20:36 +0000 (11:20 -0700)] 
Add link to new security policy (#150800)

4 days agogh-141627: Fix BufferedRandom inheritance documentation (GH-141629)
Mohsin Mehmood [Tue, 2 Jun 2026 18:06:39 +0000 (23:06 +0500)] 
gh-141627: Fix BufferedRandom inheritance documentation (GH-141629)

BufferedRandom does not inherit from BufferedReader and BufferedWriter
in the C implementation.

4 days agogh-101913: changed wording of docstring for _parsedate_tz (#134446)
Gustaf [Tue, 2 Jun 2026 15:02:19 +0000 (17:02 +0200)] 
gh-101913: changed wording of docstring for _parsedate_tz (#134446)

Fixed incorrect word.

Co-authored-by: Gustaf <79180496+GGyll@users.noreply.github.com>
4 days agogh-148587: Document `sys.lazy_modules` (#150742)
Bartosz Sławecki [Tue, 2 Jun 2026 15:00:45 +0000 (17:00 +0200)] 
gh-148587: Document `sys.lazy_modules` (#150742)

4 days agoSilence experimental coroutine deprecation warnings (#150788)
Hugo van Kemenade [Tue, 2 Jun 2026 14:55:28 +0000 (17:55 +0300)] 
Silence experimental coroutine deprecation warnings (#150788)

Co-authored-by: Zachary Ware <zach@python.org>
4 days agogh-149187: Document `frozendict()` under 'Built-in Functions' (#149185)
Øyvind Rønningstad [Tue, 2 Jun 2026 13:55:16 +0000 (15:55 +0200)] 
gh-149187: Document `frozendict()` under 'Built-in Functions' (#149185)

4 days agogh-150766: export `_PyGC_VisitFrameStack` and `_PyGC_VisitStackRef` functions (#150767)
Kumar Aditya [Tue, 2 Jun 2026 13:08:21 +0000 (18:38 +0530)] 
gh-150766: export `_PyGC_VisitFrameStack` and `_PyGC_VisitStackRef` functions (#150767)

4 days agogh-89554: Document _thread.LockType as a class (#150684)
Bernát Gábor [Tue, 2 Jun 2026 12:55:01 +0000 (05:55 -0700)] 
gh-89554: Document _thread.LockType as a class (#150684)

_thread.LockType is a class (the type of lock objects), but was documented
with the ".. data::" directive, so ":class:" cross-references to it cannot
resolve against a py:class target.

Switch the entry to ".. class::", move it next to the lock methods, and
document acquire(), release() and locked() as methods of the class.  Keep
the old _thread.lock.* URL fragments working with raw HTML anchors.

4 days agogh-115119: Fix libmpdec detection when pkg-config files are missing (#150502)
stratakis [Tue, 2 Jun 2026 09:43:30 +0000 (11:43 +0200)] 
gh-115119: Fix libmpdec detection when pkg-config files are missing (#150502)

The fallback for systems with no mpdecimal .pc files used AC_LINK_IFELSE
directly, which relied on LIBMPDEC_LIBS being set. On failure this was empty
so the link test ran without -lmpdec.

Use AC_CHECK_HEADER and AC_CHECK_LIB instead.

4 days agogh-149079: Fix O(n^2) canonical ordering in unicodedata.normalize() (GH-149080)
Seth Larson [Tue, 2 Jun 2026 09:39:50 +0000 (02:39 -0700)] 
gh-149079: Fix O(n^2) canonical ordering in unicodedata.normalize() (GH-149080)

Replace the insertion sort used for canonical ordering of combining
characters with a hybrid approach: insertion sort for short runs (< 20)
and counting sort for longer runs, reducing worst-case complexity from
O(n^2) to O(n). This prevents denial of service via crafted Unicode
strings with many combining characters in alternating CCC order.

Co-authored-by: ch4n3-yoon <ch4n3.yoon@gmail.com>
Co-authored-by: Seokchan Yoon <13852925+ch4n3-yoon@users.noreply.github.com>
Co-authored-by: Stan Ulbrych <stan@python.org>
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
Co-authored-by: Petr Viktorin <encukou@gmail.com>
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
Co-authored-by: Maurycy Pawłowski-Wieroński <maurycy@maurycy.com>
4 days agogh-149805: Fix `SystemError` when compiling `__classdict__` class annotation (#149806)
Stan Ulbrych [Tue, 2 Jun 2026 09:17:03 +0000 (10:17 +0100)] 
gh-149805: Fix `SystemError` when compiling `__classdict__` class annotation (#149806)

4 days agoFix two typos in 'Exception Handling' C-API documentation (#150674)
Manoj K M [Tue, 2 Jun 2026 09:14:13 +0000 (14:44 +0530)] 
Fix two typos in 'Exception Handling' C-API documentation (#150674)

4 days agogh-149738: Fix segmentation fault bug in sqllite3 (#149754)
Sepehr Rasouli [Tue, 2 Jun 2026 09:07:08 +0000 (12:37 +0330)] 
gh-149738: Fix segmentation fault bug in sqllite3 (#149754)

Deleting the `row_factory` or `text_factory` attribute is no longer allowed.

4 days agogh-150052: Resolve un-loaded lazily loaded submodules via `module.__getattr__` instea...
Bartosz Sławecki [Tue, 2 Jun 2026 08:58:51 +0000 (10:58 +0200)] 
gh-150052: Resolve un-loaded lazily loaded submodules via `module.__getattr__` instead of publishing lazy values (#150055) (#150744)

4 days agogh-89554: Document typing.ParamSpecArgs and ParamSpecKwargs as classes (GH-150677)
Bernát Gábor [Tue, 2 Jun 2026 08:07:51 +0000 (01:07 -0700)] 
gh-89554: Document typing.ParamSpecArgs and ParamSpecKwargs as classes (GH-150677)

Use the directive "class" instead of "data" for ParamSpecArgs and ParamSpecKwargs.

4 days agogh-89554: Document standard type objects in types as classes (GH-150676)
Bernát Gábor [Tue, 2 Jun 2026 08:03:36 +0000 (01:03 -0700)] 
gh-89554: Document standard type objects in types as classes (GH-150676)

Use the directive and the role "class" instead of "data" for classes
exposed in the types module.

4 days agogh-89554: Document weakref type objects as classes (#150678)
Bernát Gábor [Tue, 2 Jun 2026 07:59:15 +0000 (00:59 -0700)] 
gh-89554: Document weakref type objects as classes (#150678)

Use the "class" directive instead of "data" for ReferenceType,
ProxyType and CallableProxyType.

4 days agogh-89554: Document NoneType, NotImplementedType and EllipsisType as classes (GH-150682)
Bernát Gábor [Tue, 2 Jun 2026 07:55:01 +0000 (00:55 -0700)] 
gh-89554: Document NoneType, NotImplementedType and EllipsisType as classes (GH-150682)

Always use the directive and the role "class" instead of "data" for
NoneType, NotImplementedType and EllipsisType.

4 days agogh-150717: Avoid mark-array allocation for groupless regex patterns (GH-150719)
Bernát Gábor [Tue, 2 Jun 2026 07:45:30 +0000 (00:45 -0700)] 
gh-150717: Avoid mark-array allocation for groupless regex patterns (GH-150719)

state_init() always did PyMem_New(state->mark, groups*2), which for a
pattern with no capturing groups is PyMem_Malloc(0) -- a real allocation
(plus matching free) on every match/search/fullmatch call, for an array
that is never read: groupless patterns emit no MARK opcodes and group 0's
span is taken from state->start/ptr.

Guard the allocation with `if (pattern->groups)`. state->mark stays NULL
(set by the preceding memset), and both the error path and state_fini
already PyMem_Free(NULL) safely.

4 days agogh-150228: Improve the PEP 829 batch processing APIs (#150542)
Barry Warsaw [Tue, 2 Jun 2026 01:43:18 +0000 (18:43 -0700)] 
gh-150228: Improve the PEP 829 batch processing APIs (#150542)

* gh-150228: Improve the PEP 829 batch processing APIs

As previously discussed with @ncoghlan and approved for 3.15b2 by @hugovk,
this implements the batch processing APIs for addsitedir() and friends.  We
remove the `defer_processing_start_files` flag which required some implicit
module global state, and promote StartupState to the public documented API.

This also moves the bulk of the module global functions into methods of the
`StartupState` class, so it removes the awkward APIs in 3.15b1.  Now, instances
of this class are an accumulator for startup state, using `StartupState.process()`
to process them.  Callers can now batch up startup state themselves by using
the methods on this class.  The module global functions are shims for this
which preserve the legacy APIs and semantics using the new state class.

This PR also fixes the interleaving regression identified by @ncoghlan in the
same issue.  Now, .pth file sys.path extensions are added to sys.path after
the sitedir that the .pth file is found in, restoring the legacy behavior.

Along the way, I've made a lot of improvements to function docstrings,
site.rst documentation, and comments in the code explaining what's going on.

* Add a note that if known_paths is provided to StartupState.__init__(), it
  will get mutated in place.
* Improve some conditional flows.
* Improve some comments.
* Improve the what's new entry.

* Make test_impl_exec_imports_suppressed_by_matching_start() more robust

Based on PR comment, we need to read both the .pth and .start files, and prove
that the .pth file's import line (which passes a bigger increment) is not
called, but the .start file's entry point (which uses the default increment)
is called.

* As per review, move some methods to the private API

_read_pth_file() and _read_start_file() are not intended to be part of the
public API surface outside of the site module, so even though they are used by
methods outside of the StartupState class, make them privately named.

* Resolve several review feedbacks

* Move a `versionadded`
* Better list comprehension formatting (use the output from
  `ruff format --line-length 78`)

* Add docs for site.makepath() and point the case-normalization requirement to
  this utility function.
* Note that StartupState.process() is not idempotent.

* Address another feedback comment

This time, we get rid of the legacy implementation `reset` local, which was
always difficult to understand, and just implement a return value based on the
processing mode selected.

* Changes based on gh-150228 review

The comment by @encukou that started this change:

```
I still see two red flags here though: an argument that doesn't combine with
other arguments, and (another instance of) changing the return type based on
an argument.

Did you consider adding a StartupState.addsitedir(sitedir) method, instead of
the startup_state argument?
```

As it turns out, this is an even cleaner design.  By moving the bulk of the
previous module global functions into `StartupState` methods, we can get rid
of all the awkward `startup_state` keyword-only arguments which conflict
with `known_path` (Petr's first point).  We can also get rid of the
return value dichotomy (Petr's second point) because now we can preserve
exactly the Python 3.14 API in the module global functions, and implement
the better APIs in the class methods.  We also generally don't have to
pass around `process_known_sitedirs`.

Now the following module global functions are essentially shims around
class methods:

* site.addsitedir() -> StartupState.addsitedir()
* site.addusersitepackages() -> StartupState.addusersitepackages()
* site.addsitepackages() -> StartupState.addsitepackages()
* Additional minor changes
* Remove a now unused parameter

Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
4 days agogh-150720: Remove '-d 1' in test_script_error_treatment (#150736)
László Kiss Kollár [Tue, 2 Jun 2026 00:51:51 +0000 (01:51 +0100)] 
gh-150720: Remove '-d 1' in test_script_error_treatment (#150736)

4 days agogh-150644: Tag Apple system log messages as public. (#150645)
Russell Keith-Magee [Mon, 1 Jun 2026 22:25:46 +0000 (06:25 +0800)] 
gh-150644: Tag Apple system log messages as public. (#150645)

macOS 26 changed the default visibility of "dynamic" system messages. This
changes the logging strategy to tag all messages as "public" so they are
visible in the system log without special configuration.

5 days agogh-150429: Fix sampling profiler generator stack test (#150433)
Pablo Galindo Salgado [Mon, 1 Jun 2026 20:27:39 +0000 (21:27 +0100)] 
gh-150429: Fix sampling profiler generator stack test (#150433)

5 days agogh-93417: Improve test_mimetypes (GH-150725)
Serhiy Storchaka [Mon, 1 Jun 2026 20:02:40 +0000 (23:02 +0300)] 
gh-93417: Improve test_mimetypes (GH-150725)

* Separate tests for module-level API and for the MimeTypes class.
* Add tests for mimetypes.init() and MimeTypes() with knownfiles and with
  explicitly passed files.

5 days agogh-148672: Document namespace subpackages inside regular packages (#150056)
Taeknology [Mon, 1 Jun 2026 19:22:42 +0000 (04:22 +0900)] 
gh-148672: Document namespace subpackages inside regular packages (#150056)

5 days agogh-115119: Remove superfluous TEST_COVERAGE private macro from _decimal module (GH...
Sergey B Kirpichev [Mon, 1 Jun 2026 18:41:21 +0000 (21:41 +0300)] 
gh-115119: Remove superfluous TEST_COVERAGE private macro from _decimal module (GH-149756)

It was previously shared with `libmpdec`, which is no longer vendored.

5 days agoGH-148960: Reduce the size of the debug stencils to less than half. (GH-150551)
Mark Shannon [Mon, 1 Jun 2026 16:56:16 +0000 (17:56 +0100)] 
GH-148960: Reduce the size of the debug stencils to less than half. (GH-150551)

For AArch64 linux, reduces the total bytes in the code bodies from 489kb to 218kb.
Reduces the size of the stencils files from 394k lines to 167k lines.

5 days agoGH-150478: Add "show_jit" option to `dis.dis` to show jit entry points (GH-150554)
Mark Shannon [Mon, 1 Jun 2026 16:52:40 +0000 (17:52 +0100)] 
GH-150478: Add "show_jit" option to `dis.dis` to show jit entry points (GH-150554)

* Shows `ENTER_EXECUTOR` instructions

5 days agogh-150436: Skip subprocess test on STATUS_DLL_INIT_FAILED (#150704)
Victor Stinner [Mon, 1 Jun 2026 14:50:15 +0000 (16:50 +0200)] 
gh-150436: Skip subprocess test on STATUS_DLL_INIT_FAILED (#150704)

If a subprocess spawned with CREATE_NEW_CONSOLE creation flag fails
with STATUS_DLL_INIT_FAILED return code, skip the test. It's likely a
memory allocation failure in the desktop heap memory which caused the
DLL init failure.

5 days agogh-150157: Fix critical section for PyDict_Next() in _pickle.c (GH-150158)
Thomas Kowalski [Mon, 1 Jun 2026 14:32:13 +0000 (16:32 +0200)] 
gh-150157: Fix critical section for PyDict_Next() in _pickle.c (GH-150158)

5 days agogh-149534: Fix unification of `defaultdict` and `frozendict` with `|` (#149539)
sobolevn [Mon, 1 Jun 2026 13:26:49 +0000 (16:26 +0300)] 
gh-149534: Fix unification of `defaultdict` and `frozendict` with `|` (#149539)

5 days agogh-149046: fix: correctly handle `str` subclasses in `io.StringIO` (#149047)
Thomas Kowalski [Mon, 1 Jun 2026 13:01:57 +0000 (15:01 +0200)] 
gh-149046: fix: correctly handle `str` subclasses in `io.StringIO` (#149047)

5 days agogh-80480: Remove deprecated 'u' array type code (#149535)
Sergey B Kirpichev [Mon, 1 Jun 2026 11:57:55 +0000 (14:57 +0300)] 
gh-80480: Remove deprecated 'u' array type code (#149535)

Reuse array.typecodes in tests.

5 days agogh-150368: Change Windows user group to secure identifier in test_tempfile (#150369)
Dawid Konrad Kohnke [Mon, 1 Jun 2026 11:35:48 +0000 (13:35 +0200)] 
gh-150368: Change Windows user group to secure identifier in test_tempfile (#150369)

5 days agogh-148508: Add another common pattern for iOS SSL failures to test_ssl (#150442)
Russell Keith-Magee [Mon, 1 Jun 2026 09:37:53 +0000 (17:37 +0800)] 
gh-148508: Add another common pattern for iOS SSL failures to test_ssl (#150442)

Match also '[SSL: HTTP_REQUEST] http request (_ssl.c:1143)'.

6 days agogh-150685: update bundled pip to 26.1.2 (gh-150686)
Stéphane Bidoul [Sun, 31 May 2026 19:28:02 +0000 (21:28 +0200)] 
gh-150685: update bundled pip to 26.1.2 (gh-150686)

6 days agoClarify docs for scheduler.run(blocking=False) (GH-129575)
M. Greyson Christoforo [Sun, 31 May 2026 12:11:17 +0000 (13:11 +0100)] 
Clarify docs for scheduler.run(blocking=False) (GH-129575)

6 days agogh-150636: Clarify difference between copy.copy() and the copy() methods (GH-150637)
Serhiy Storchaka [Sun, 31 May 2026 12:08:55 +0000 (15:08 +0300)] 
gh-150636: Clarify difference between copy.copy() and the copy() methods (GH-150637)

Co-authored-by: Pieter Eendebak <pieter.eendebak@gmail.com>
Co-authored-by: Stan Ulbrych <stan@python.org>
6 days agogh-148605: Remove irepeat() thread test from test_bytes (#150576)
Victor Stinner [Sun, 31 May 2026 09:27:10 +0000 (11:27 +0200)] 
gh-148605: Remove irepeat() thread test from test_bytes (#150576)

6 days agogh-140553: Mark `*gettext` parameters as positionaly only in documentation (#140598)
Stan Ulbrych [Sun, 31 May 2026 08:08:17 +0000 (09:08 +0100)] 
gh-140553: Mark `*gettext` parameters as positionaly only in documentation (#140598)

6 days agogh-131178: Fix mimetypes CLI docs, mention that errors go to stdout (#149683)
htjworld [Sun, 31 May 2026 07:45:48 +0000 (16:45 +0900)] 
gh-131178: Fix mimetypes CLI docs, mention that errors go to stdout (#149683)

Co-authored-by: sobolevn <mail@sobolevn.me>
6 days agoCorrect frexp() docs for zero and non-finite numbers (GH-149753)
Sergey B Kirpichev [Sun, 31 May 2026 07:29:44 +0000 (10:29 +0300)] 
Correct frexp() docs for zero and non-finite numbers (GH-149753)

0.5 <= abs(m) < 1 is only true for finite nonzero numbers

6 days agogh-149609: Raise deprecation warnings for `abc.{abstractclassmethod,abstractstaticmet...
sobolevn [Sun, 31 May 2026 07:26:52 +0000 (10:26 +0300)] 
gh-149609: Raise deprecation warnings for `abc.{abstractclassmethod,abstractstaticmethod,abstractproperty}` (#149636)

6 days agogh-117291: Explain usage of null bytes in Array(c_char).value (GH-117292)
Patrick Rauscher [Sun, 31 May 2026 07:20:49 +0000 (09:20 +0200)] 
gh-117291: Explain usage of null bytes in Array(c_char).value (GH-117292)

6 days agogh-141444:fix broken URLs and examples in urllib.request.rst (#144863)
Paper Moon [Sun, 31 May 2026 02:08:18 +0000 (10:08 +0800)] 
gh-141444:fix broken URLs and examples in urllib.request.rst (#144863)

* Doc: fix broken URLs and examples in urllib.request.rst (gh-141444)

* Doc: update urllib.request examples to handle gzip compression

---------

Co-authored-by: Senthil Kumaran <senthil@python.org>
7 days agoAdd @itamaro to CODEOWNERS (#150635)
Itamar Oren [Sat, 30 May 2026 20:49:11 +0000 (13:49 -0700)] 
Add @itamaro to CODEOWNERS (#150635)

Added myself as a code owner across CI and build-system areas