Commit Graph

131797 Commits

Author SHA1 Message Date
JasonMendoza2008 ecbd31ee39 gh-137759: Replace _PyObject_HashFast() with PyObject_Hash() in setobject.c (#137828)
Replace also _PyObject_HashFast() with PyObject_Hash()
in _collections._count_elements().

Rename _PyObject_HashFast() to _PyObject_HashDictKey(),
and mark it as Py_ALWAYS_INLINE.

Only use _PyObject_HashDictKey() on dictionaries.
2026-06-15 11:31:04 +02:00
sobolevn 7a70afa199 Add .toml to .editorconfig (#151481) 2026-06-15 12:14:11 +03:00
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
Ivy Xu 1097b22fd9 gh-151428: Remove unused imports from Tools/ (#151442) 2026-06-14 16:12:30 +03:00
Aniket 47b7dc788c gh-139837: Document attributes of objects recorded by warnings.catch_warnings (GH-139893)
Co-authored-by: Victor Stinner <vstinner@python.org>
2026-06-14 15:39:33 +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
Maurycy Pawłowski-Wieroński 6ce088e20a gh-151424: Fix impossible stack traces in RemoteUnwinder(..., cache_frames=True) by copying chunks on cache miss (#151426) 2026-06-14 00:10:56 +01:00
Shardul Deshpande 9ad6ba0324 gh-151443: Fix documented default of unittest.mock.mock_open's read_data parameter (#151444) 2026-06-13 18:31:03 +00:00
tonghuaroot (童话) 6679ac07d8 gh-151403: Fix use-after-free when an argv item's __fspath__ mutates args (GH-151404)
---------

Co-authored-by: tonghuaroot <23011166+tonghuaroot@users.noreply.github.com>
2026-06-13 10:23:44 -07:00
Stan Ulbrych e933987688 gh-77328: Update base64 module RFC references to RFC 4648 (#151275) 2026-06-13 12:21:54 +00:00
Jonathan Dung 5b38519762 Docs: Fix method directive signatures in enum docs (#151429) 2026-06-13 09:47:23 +01: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
Rafael Fontenelle f4f102027a Fix typos in the curses.ascii module documentation (#129300)
Co-authored-by: Stan Ulbrych <stan@python.org>
2026-06-12 16:02:33 +00:00
Maciej Olko d986124d83 Docs: avoid repetitions of class references in functions.rst (#150891) 2026-06-12 17:53:06 +03:00
sobolevn 6b217ea90b gh-151126: Fix crash on unset memory error in ctypes.get_errno (#151382) 2026-06-12 14:03:21 +03:00
Matt Wozniski c37599200f gh-151297: Fix undefined behavior in _PyObject_MiRealloc (GH-151358)
The standard says that a call to `memcpy` must pass a valid source and
destination pointer even if the size is 0, so we must avoid calling
`memcpy` when our source pointer is NULL. If we don't, an optimizing
compiler can decide that the pointer must be non-NULL based on the
presence of UB, and optimize out checks for null pointers.

Specifically, note that the standard says:

    Where an argument declared as size_t n specifies the length of the
    array for a function, n can have the value zero on a call to that
    function. Unless explicitly stated otherwise in the description of
    a particular function in this subclause, pointer arguments on such
    a call shall still have valid values, as described in 7.1.4.

And section 7.1.4 says:

    If an argument to a function has an invalid value (such as a value
    outside the domain of the function, or a pointer outside the address
    space of the program, or a null pointer, or a pointer to
    non-modifiable storage when the corresponding parameter is not
    const-qualified) or a type (after default argument promotion) not
    expected by a function with a variable number of arguments, the
    behavior is undefined.

The specification for `memcpy` doesn't state that it's allowed to be
called with null pointers, and Linux's `/usr/include/string.h` declares
`memcpy` as `__nonnull ((1, 2))`.
2026-06-11 21:21:04 -04:00
Peter Bierma 80f9467434 gh-151065: Copy fix for memory leak from mimalloc upstream (GH-151066)
Applies https://github.com/microsoft/mimalloc/commit/d7a72c4912943e8aaf135e465ca5ea229ea96646 to our copy of mimalloc.
2026-06-11 18:11:52 -04:00
Ivy Xu 71805db429 gh-151337: Avoid possible memory leak in _tkinter.c on Windows. (GH-151340) 2026-06-11 22:55:11 +03: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
Serhiy Storchaka 65047f2e2f gh-150285: Fix too long docstrings in GenericAlias and __class_getitem__ (GH-151354) 2026-06-11 19:52:58 +03:00
Pieter Eendebak 36fe7784b0 gh-150942: Speed up json.loads array and object decoding (GH-150945)
Append parsed values to the result list with _PyList_AppendTakeRef and
insert key/value pairs with _PyDict_SetItem_Take2, which take ownership of
the references instead of incref-ing on insert and then decref-ing the
local.  This removes a reference-count round-trip per element (and, on the
free-threaded build, a per-append lock).

Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-11 17:38:49 +01:00
Dino Viehland efb2fffae1 gh-150490: Raise PyType_Modified for insertion into split dictionary (#150489)
Raise PyType_Modified for insertion into split dictionary
2026-06-11 09:38:31 -07:00
Kumar Aditya 6112d70abe gh-151228: fix data race on clearing embedded dict values (#151330) 2026-06-11 21:37:00 +05:30
sobolevn 10595b1cb7 gh-151126: Fix missing memory error in os._path_splitroot (#151339) 2026-06-11 15:48:08 +00:00
Cody Maloney b18168cb32 gh-101100: Fix Sphinx nitpick in unittest.mock.rst (#151302) 2026-06-11 16:29:40 +01:00
Maciej Olko b9bffc09a6 gh-139588: Fix nondeterministic make latex doc build under parallel make (#151343) 2026-06-11 16:13:22 +01:00
Thomas Kowalski 1ec6596828 gh-150858: fix data race while changing __qualname__ of a type object(#150859) 2026-06-11 15:07:36 +00:00
Stan Ulbrych 937d89c4d9 gh-151112: Fix crash in compiler_mod() when entering the current compilation unit fails (#151234) 2026-06-11 15:52:11 +01:00
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
Victor Stinner 82956594bb Remove unused internal _Py_REF_IS_QUEUED() function (#151236) 2026-06-11 12:54:36 +02:00
Stan Ulbrych 2d3381035d gh-151112: Move an assert that may fail in cfg_builder_check (#151153) 2026-06-11 10:16:27 +01:00
Peter Bierma f9ffca3935 gh-151177: Fix race condition in _testembed (GH-151293) 2026-06-11 11:06:48 +02:00
Stan Ulbrych 9620f69cd4 Drop historical :author:s from HOWTOs (#151091) 2026-06-11 09:46:39 +01: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
glennglazer 84630e2cb9 gh-136880: Add warning about PYTHONPATH (GH-151098) 2026-06-11 07:14:34 +01: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 3a8bebd86f GHA: Display output when a sanitizer test fails (#151268)
Modify GitHub Action "Reusable Sanitizer" to display output when a
test fails: pass -W option.
2026-06-10 19:07:51 +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