Commit graph

57332 commits

Author SHA1 Message Date
Victor Stinner
18f3ffec43
gh-149671: Restore compatibility with setuptools -nspkg.pth files in site module (#151319)
Inject the "sitedir" variable in the frame which executes ".pth" code.
2026-06-15 08:29:52 +00:00
Stan Ulbrych
d63c9940f0
gh-130197: Test pygettext's --version CLI option (#133022) 2026-06-14 19:17:45 +00:00
Bartosz Sławecki
a7007322c2
gh-151390: Colorize match + and match - in the REPL (#151391) 2026-06-14 19:06:30 +03:00
Bartosz Sławecki
f1a5f68e37
gh-151461: Fix encoding-related exception handling in file tokenizer (GH-151462) 2026-06-14 12:33:03 +00:00
Gregory P. Smith
e91f68ab40
Skip test_highly_nested_objects_decoding during the PGO profile task. (GH-151460)
Since the recursion guard tracks real C-stack bounds (gh-91079), this test
asserts that 500k nesting levels overflow the stack margin. On a 64 MiB stack
(some Nix build envs use one that large), the optimized interpreter uses ~160
bytes/level (raises at ~420k levels) so the assertion holds with only ~16%
margin; the PGO *instrumented* stage inlines less, its per-level scanner frames
are smaller, and the 500k-deep decode completes -- "RecursionError not raised"
fails the profile run and aborts `make profile-opt`. Upstream's
skip_if_unlimited_stack_size (gh-143460) only covers RLIM_INFINITY, not
large-finite stacks like ours.

We could also keep playing whack a mole and raise the 500k to a much larger
number... but there's little value in PGO training on this test anyways.
2026-06-14 12:29:26 +00:00
Ivy Xu
a7885b46f1
gh-151428: Remove unused imports in the stdlib (#151440) 2026-06-14 13:00:28 +01:00
Stan Ulbrych
e933987688
gh-77328: Update base64 module RFC references to RFC 4648 (#151275) 2026-06-13 12:21:54 +00:00
Daniel Shields
3c00ebc2bb
gh-101267: ProcessPoolExecutor no longer shares 1 BrokenProcessPool exception among all failed futures (GH-101268)
Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
Co-authored-by: Gregory P. Smith <greg@krypto.org>
2026-06-13 01:23:39 -07:00
Ivy Xu
507250b750
Correct the docstring of logging.config (GH-151353) 2026-06-11 19:29:20 +01:00
Serhiy Storchaka
d2e27aca4b
gh-150285: Fix overflow in too long lines for class data in pydoc (GH-151366)
Use all available space (80 columns) for formatting reprs
of module and class data, but ensure that they do not overflow.
2026-06-11 20:50:00 +03:00
Aniket
402668b2b1
gh-138991: Update dataclass documentation for new eq behavior in Python 3.13 (#139007)
And add tests.

Co-authored-by: Victor Stinner <vstinner@python.org>
2026-06-11 17:15:29 +00:00
Kumar Aditya
6112d70abe
gh-151228: fix data race on clearing embedded dict values (#151330) 2026-06-11 21:37:00 +05:30
Victor Stinner
0bbde07a0b
gh-150397: Fix pyexpat bigmem test (#151329)
Add missing parameter (size).
2026-06-11 16:45:44 +02:00
Stan Ulbrych
4b44b1e1fd
gh-151238: Check for _get_resized_exprs failure in _PyPegen_{joined,template}_str (#151259) 2026-06-11 15:26:46 +01:00
Serhiy Storchaka
0066fd73a2
gh-150285: Suppress showing the __getstate__() comment in the help for dataclasses (GH-151328) 2026-06-11 15:23:19 +03:00
Timofei
a05b9cde93
gh-151179: Fix pidfd leak in asyncio _PidfdChildWatcher (#151186) 2026-06-11 11:43:46 +00:00
Victor Stinner
72e7eddce6
gh-123619: Fix PyUnstable_Object_EnableDeferredRefcount() (#151260)
Return 0 if the object is not tracked by the GC.
2026-06-11 12:55:13 +02:00
Victor Stinner
d87d772873
gh-151284: Fix test_capi on UBSan (#151286)
Comment two checks relying on undefined behavior in
test_fromwidechar() of test_capi.

Enable test_capi in GitHub Action "Reusable Sanitizer".
2026-06-11 10:55:09 +00:00
tonghuaroot (童话)
84a322aa15
gh-151295: Fix use-after-free in bytes.join()/bytearray.join() via re-entrant __buffer__ (GH-151296) 2026-06-11 07:51:43 +00:00
Victorien
871047dbb8
gh-139819: Use builtin sentinel in rlcompleter (GH-151222)
Co-authored-by: Ethan Furman <ethan@stoneleaf.us>
2026-06-10 13:43:09 -07:00
Victor Stinner
e60c42dc3f
gh-151278: Fix test_faulthandler on UBSan (#151279)
* Py_FatalError() no longer calls _PyFaulthandler_Fini() if it
  doesn't hold the GIL.
* Skip test_faulthandler tests raising signals if run with UBSan.
* Enable test_faulthandler in GitHub Action "Reusable Sanitizer".
2026-06-10 21:39:03 +02:00
Victor Stinner
7b6e98911e
gh-151253: Dump the Python path configuration on _PyCodec_InitRegistry() failure (#151250)
If "import encodings" fails at Python startup, dump the Python path
configuration to help users debugging their configuration. The
encodings module is the first module imported during Python startup.
2026-06-10 18:43:38 +02:00
tonghuaroot (童话)
896f7fdc7d
gh-143988: Fix re-entrant mutation crashes in socket sendmsg/recvmsg_into (#143987)
Fix crashes in socket.sendmsg() and socket.recvmsg_into() that could
occur if buffer sequences are mutated re-entrantly during argument
parsing via __buffer__ protocol callbacks.

The bug occurs because:

1. PySequence_Fast() returns the original list object when the input
   is already a list (not a copy).
2. During iteration, PyObject_GetBuffer() triggers __buffer__
   callbacks which may clear the list.
3. Subsequent iterations access invalid memory (heap OOB read).

The fix replaces PySequence_Fast() with PySequence_Tuple() which
always creates a new tuple, ensuring the sequence cannot be mutated
during iteration.

Co-authored-by: tonghuaroot <23011166+tonghuaroot@users.noreply.github.com>
2026-06-10 13:03:49 +00:00
Lukas Geiger
f2a0f82282
gh-150988: Fix refleak in OSError when attrs are set before super().__init__() (#150990)
Co-authored-by: Victor Stinner <vstinner@python.org>
2026-06-10 12:27:11 +00:00
Serhiy Storchaka
3ca93ab198
Add yet one assertion in test_set_text_charset_cp949 (GH-151224)
Check bytes(m), not only str(m).
2026-06-10 14:36:14 +03:00
stratakis
3a08e93739
gh-98894: Fix DTrace test_check_probes for shared builds (#151122)
When building with --enable-shared, the SystemTap/DTrace notes
live in libpython. Add detection logic to be used by readelf.

Force the C locale on readelf output.
2026-06-10 13:08:25 +02:00
Serhiy Storchaka
16f71bda3f
gh-150285: Wrap long single-line summary in text output in pydoc (GH-151081) 2026-06-10 13:44:35 +03:00
Serhiy Storchaka
ca32ebf793
gh-80384: Check that callback is callable at weak reference creation (GH-151145)
* Python functions weakref.ref() and weakref.proxy() now raise TypeError
  if the callback argument is not callable or None.
* C functions PyWeakref_NewRef() and PyWeakref_NewProxy() now raise TypeError
  if the callback argument is not callable, None, or NULL.

Co-authored-by: Maxwell Bernstein <emacs@fb.com>
2026-06-10 13:34:55 +03:00
Harjoth Khara
7a014f44c3
gh-109940: Respect VIRTUAL_ENV_DISABLE_PROMPT in activate.bat (GH-151215) 2026-06-10 09:48:16 +01:00
Bartosz Sławecki
ff64d8de66
gh-145239: Colorize case + in the REPL (#150979) 2026-06-10 09:36:50 +03:00
Bartosz Sławecki
ce916dc506
gh-150700: Fix class-scope inline comprehensions when nested scopes reference __class__ and friends (#150735)
* Fix class-scope inline comprehensions when nested scopes reference `__class__` and friends

In `inline_comprehension()`, when `__class__` / `__classdict__` /
`__conditional_annotations__` appears as `FREE` in a comprehension's
symbol table because a nested scope captured it (e.g. nested lambdas),
this name is still discarded from `comp_free` unconditionally.

This prevents `drop_class_free()` from seeing it, so the appropriate
`ste_needs_(...)` flag is never set on the enclosing class.
That leads to `codegen_make_closure()` throwing `SystemError` when it
couldn't find `__class__` / `__classdict__` /
`__conditional_annotations__` in the class's cellvars.

From now on we just discard from `comp_free` when no child scope
(e.g. a lambda) still needs the name as `FREE`. When a child scope does
need it, keep it in `comp_free` so `drop_class_free()` can set the
appropriate flag and the class creates the implicit cell.

* Fix tests

* Fix typo

* Fix formatting

* Add test checking validity of `__class__` returned

* Prefer 'used' to 'deferred'
2026-06-09 15:22:13 -07:00
Peter
81c1cdcf4a
gh-139819: rlcompleter – avoid suggesting attributes not accessible on instances (GH-139820)
Co-authored-by: Ethan Furman <ethan@stoneleaf.us>
2026-06-09 11:00:23 -07:00
Serhiy Storchaka
0fa06f4d7f
gh-150285: Fix too long docstrings in the concurrent package (GH-151076) 2026-06-09 19:14:10 +03:00
Serhiy Storchaka
ed2b04248a
gh-150285: Fix too long docstrings in the asyncio package (GH-151074) 2026-06-09 19:13:34 +03:00
Robsdedude
b2e2cd3912
gh-150898: Assume OpenSSL supports keylogging (#150870)
Since version 3.10, CPython requires OpenSSL 1.1.1 or higher.
Therefore, support for keylogging can be assumed.

Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
Co-authored-by: Victor Stinner <vstinner@python.org>
2026-06-09 16:37:38 +02:00
sobolevn
9fdbade99e
gh-151039: Fix a crash when _datetime types outlive _datetime module (#151044) 2026-06-09 11:44:37 +00:00
Serhiy Storchaka
c3cd75afdf
gh-151130: Add more tests for PyWeakref_* C API (GH-151131) 2026-06-09 11:11:17 +00:00
Cody Maloney
db4b1948bc
gh-143008: Fix Null pointer dereferences in TextIOWrapper underlying stream access (#145957)
TextIOWrapper keeps its underlying stream in a member called
`self->buffer`. That stream can be detached by user code, such as custom
`.flush` implementations resulting in `self->buffer` being set to NULL.
The implementation often checked at the start of functions if
`self->buffer` is in a good state, but did not always recheck after
other Python code was called which could modify `self->buffer`.

The cases which need to be re-checked are hard to spot so rather than
rely on reviewer effort create better safety by making all self->buffer
access go through helper functions.

Thank you yihong0618 for the test, NEWS and initial implementation in
gh-143041.

Co-authored-by: yihong0618 <zouzou0208@gmail.com>
Co-authored-by: Victor Stinner <vstinner@python.org>
2026-06-09 12:31:44 +02:00
Barry Warsaw
fccf67a354
gh-150633: Minor improvement of a newly added test (#151103)
Minor improvement of a newly added test.
2026-06-08 19:21:00 +00:00
Thomas Kowalski
54de5475cd
gh-150633: Properly handle null characters in the name when importing frozen modules (GH-150634) 2026-06-08 21:31:54 +03:00
Eduardo Villalpando Mello
5c13217314
gh-148932: Fix profiling.sampling on Windows virtual environments (#150541) 2026-06-08 17:25:43 +00:00
Victor Stinner
a9002349cb
gh-151019: Fix test_os on 32-bit FreeBSD (#151087)
Remove references to server.handler_instance. This attribute has been
removed in 2022 by commit 3ae975f1ac.
2026-06-08 18:57:07 +02:00
Stan Ulbrych
5755d0f083
gh-150599: Prevent bz2 decompressor reuse after errors (#150600) 2026-06-07 08:19:05 -07:00
Bernát Gábor
e5ced1f778
gh-150885: Remove unused shutil._ensure_directory (GH-150883)
No longer used after gh-146581 (GH-146591).
2026-06-07 17:40:55 +03:00
esadomer
f2cab7b0cf
gh-151021: Fix mmap empty searches past the end (GH-151023) 2026-06-07 16:01:24 +03:00
Sanyam Kumat
ab930175e7
gh-148954: Escape methodname in xmlrpc.client.dumps() to prevent XML injection (GH-148968) 2026-06-06 21:38:15 +00:00
Zackery Spytz
69851a6407
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>
2026-06-06 17:14:45 +00:00
Edward Xu
12af26d17e
gh-150411: fix gc_generation.count race in free-threading (#150413) 2026-06-06 17:03:04 +00:00
Jelle Zijlstra
884ac3e3ec
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.
2026-06-06 05:47:33 -07:00
Jeff Epler
b6e66136cc
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.
2026-06-06 10:19:45 +00:00