125763 Commits

Author SHA1 Message Date
Tomas R.
e091520fdb
gh-126085: Add tp_iter to TypeAliasType to allow star unpacking (#127981) 2025-03-04 11:34:59 -08:00
Chris Eibl
d8a1cf469e
gh-130090: Support PGO for clang-cl on Windows (GH-129907) 2025-03-04 19:29:03 +00:00
Victor Stinner
3dd3675492
gh-130730: Fix multiprocessing test_active_children() (#130837)
Replace a sleep with an event: sleep is not a reliable
synchronization primitive.
2025-03-04 17:05:20 +00:00
Mark Shannon
885c3d126f
GH-90916: Add helper function to dis.Instruction and use it to reduce churn in test_dis (GH-130643) 2025-03-04 16:43:39 +00:00
Tian Gao
63b6ec31c4
gh-82987: Stop on calling frame unconditionally for inline breakpoints (#130493) 2025-03-04 11:35:47 -05:00
Sam Gross
efadc5874c
Revert "gh-128041: Add terminate_workers and kill_workers methods to ProcessPoolExecutor (GH-128043)" (#130838)
The test_concurrent_futures.test_process_pool test is failing in CI.

This reverts commit f97e4098ff71a6488fd3411f9f9e6fa7a7bb4efe.
2025-03-04 11:19:06 -05:00
sobolevn
63ffb406bb
gh-129567: Add a note to typing.TypedDict docs about name mangling (#130233) 2025-03-04 18:15:00 +03:00
Victor Stinner
f67ff9e820
gh-130727: Retry test_wmi on TimeoutError (#130832)
Use sleeping_retry() in test_wmi to retry multiple times on
TimeoutError. Wait up to LONG_TIMEOUT seconds (5 minutes by default).
2025-03-04 16:07:01 +01:00
Jelle Zijlstra
1d251b8339
gh-128184: Fix display of signatures with ForwardRefs (#130815)
Co-authored-by: sobolevn <mail@sobolevn.me>
2025-03-04 06:58:37 -08:00
Donghee Na
80e6d3ec49
gh-130547: Fix race between dict_dealloc and split_keys_entry_added (gh-130778) 2025-03-04 22:50:33 +09:00
Petr Viktorin
d91cc9db15
gh-129666: Add C11/C++11 to docs and -pedantic-errors to GCC/clang test_c[pp]ext tests (GH-130692)
Disable pedantic check for c++03 (unlimited API)

Also add a check for c++03 *limited* API, which passes in pedantic mode
after removing a comma in the `PySendResult` declaration, and allowing
`long long`.
2025-03-04 14:10:09 +01:00
Victor Stinner
6c48ed7d62
gh-130736: Fix asyncio test_shutdown_default_executor_timeout() (#130800)
Replace time.sleep() with threading.Event.
2025-03-04 11:16:07 +00:00
Bénédikt Tran
3929af5e3a
gh-89083: add support for UUID version 7 (RFC 9562) (#121119)
Add support for generating UUIDv7 objects according to RFC 9562, §5.7 [1].

The functionality is provided by the `uuid.uuid7()` function. The implementation
is based on a 42-bit counter as described by Method 1, §6.2 [2] and guarantees
monotonicity within the same millisecond.

[1]: https://www.rfc-editor.org/rfc/rfc9562.html#section-5.7
[2]: https://www.rfc-editor.org/rfc/rfc9562.html#section-6.2

---------

Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
Co-authored-by: Victor Stinner <vstinner@python.org>
Co-authored-by: Éric <merwok@netwok.org>
2025-03-04 10:47:19 +01:00
Victor Stinner
0b6e98c841
gh-111178: Fix function signatures in structseq.c (#130683) 2025-03-04 10:33:45 +01:00
Victor Stinner
ed8675c571
gh-111178: Fix function signatures of unicodeiter (#130684) 2025-03-04 10:33:09 +01:00
Bénédikt Tran
15d926b285
gh-130149: fix HMAC tests for some FIPS-only build bots (#130788)
Skips some HMAC tests for some FIPS-only build bots that do not have the underlying hash functions.
2025-03-04 10:15:33 +01:00
Andrii Hrimov
d780f0af2b
gh-130486: Fix test_venv fails from within venv (GH-130487) 2025-03-04 07:48:07 +00:00
Neil Schemenauer
813bc5694b
gh-130599: use static constants str-to-int conversion (gh-130714)
Avoid a data race in free-threaded builds due to mutating global arrays at
runtime.  Instead, compute the constants with an external Python script and
then define them as static global constant arrays.  These constants are
used by `long_from_non_binary_base()`.
2025-03-03 19:00:50 -08:00
Tomas R.
bbf197913c
gh-124445: Allow specializing generic ParamSpec aliases (#124512)
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
2025-03-03 14:58:33 -08:00
Sergey Miryanov
3a7f17c7e2
gh-130790: Remove references about unicode's readiness from comments (#130801) 2025-03-03 19:18:09 +00:00
Victor Stinner
8a64a62002
gh-130737: Fix multiprocessing test_notify() (#130797)
Replace hardcoded delay (100 ms) with a loop awaiting until a
condition is true: replace assertReturnsIfImplemented() with
assertReachesEventually().

Use sleeping_retry() in assertReachesEventually() to tolerate slow
buildbots and raise an exception on timeout (30 seconds).
2025-03-03 18:45:26 +00:00
Barney Gale
d0eb01c9de
GH-128520: Merge pathlib._abc into pathlib.types (#130747)
There used to be a meaningful distinction between these modules: `pathlib`
imported `pathlib._abc` but not `pathlib.types`. This is no longer the
case (neither module is imported), so we move the ABCs as follows:

- `pathlib._abc.JoinablePath` --> `pathlib.types._JoinablePath`
- `pathlib._abc.ReadablePath` --> `pathlib.types._ReadablePath`
- `pathlib._abc.WritablePath` --> `pathlib.types._WritablePath`
2025-03-03 17:56:57 +00:00
Tomas R.
321bf59512
gh-130453: pygettext: Allow overriding default keywords when using --keyword (GH-130709) 2025-03-03 18:57:01 +02:00
Yuki Kobayashi
b3c18bfd82
gh-130711: Document PyBaseObject_Type (GH-130712)
Co-authored-by: Peter Bierma <zintensitydev@gmail.com>
2025-03-03 15:08:05 +01:00
Samuel Tyler
4f14b7e30c
gh-100388: Change undefined __DATE__ to the Unix epoch (#100389) 2025-03-03 14:59:46 +01:00
Bénédikt Tran
3146a25e97
gh-129173: refactor PyCodec_BackslashReplaceErrors into separate functions (#129895)
The logic of `PyCodec_BackslashReplaceErrors` is now split into separate functions,
each of which handling a specific exception type.
2025-03-03 13:58:15 +01:00
Chris Withers
04091c0833
unittest.mock test and coverage fixup (#130787)
* Mark functions that will never be called with # pragma: no cover

* Fix testpatch.PatchTest.test_exit_idempotent

.stop() and __exit__ have subtly different code paths, so to really test __exit__ idempotency, we need to call it specifically twice.
2025-03-03 11:44:59 +00:00
Bénédikt Tran
f693f84227
gh-129173: simplify PyCodec_XMLCharRefReplaceErrors logic (#129894)
Writing the decimal representation of a Unicode codepoint only requires to know the number of digits.

---------

Co-authored-by: Petr Viktorin <encukou@gmail.com>
2025-03-03 11:43:22 +00:00
Ned Batchelder
efbc5929ca
docs: internal notes have moved, correct references (#130762) 2025-03-03 06:38:49 -05:00
Bénédikt Tran
8f11af45de
gh-130149: refactor tests for HMAC (#130150)
Since we plan to introduce a built-in implementation for HMAC based on HACL*,
it becomes important for the HMAC tests to be flexible enough to avoid code
duplication.

In addition to the new layout based on mixin classes, we extend test coverage by
also testing the `__repr__` of HMAC objects and the HMAC one-shot functions.

We also fix the import to `_sha256` which, since gh-101924, resulted in some tests being
skipped as the module is no more available (its content was moved to the `_sha2` module).
2025-03-03 11:22:05 +01:00
Yuki Kobayashi
a105f99019
gh-101100: Fix sphinx warnings in library/email.errors.rst (#130774) 2025-03-03 11:56:45 +02:00
Victorien
373eb1b47a
gh-101100: Fix Sphinx documentation warnings in collections.rst (#130629) 2025-03-03 11:46:38 +02:00
Mike Castle
a85eeb9771
gh-129015: Improve disambiguation between NotImplemented and NotImplementedError (#129562)
---------

Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
2025-03-03 09:23:41 +01:00
Bénédikt Tran
097846502b
gh-127667: fix memory leaks in hashlib (#127668)
- Correctly handle `NULL` values returned by `EVP_MD_CTX_md`.
- Correctly free resources in error branches.
- Consistently suppress `_setException()` return value when needed.
- Collapse `_setException() + return NULL` into a single statement.
2025-03-03 09:20:33 +01:00
Kumar Aditya
7e3b788e8f
gh-128002: use efficient linked list implementation for eager tasks in asyncio (#130518) 2025-03-03 06:36:43 +00:00
Charles Machalow
f97e4098ff
gh-128041: Add terminate_workers and kill_workers methods to ProcessPoolExecutor (GH-128043)
This adds two new methods to `multiprocessing`'s `ProcessPoolExecutor`:
- **`terminate_workers()`**: forcefully terminates worker processes using `Process.terminate()`
- **`kill_workers()`**: forcefully kills worker processes using `Process.kill()`

These methods provide users with a direct way to stop worker processes without `shutdown()` or relying on implementation details, addressing situations where immediate termination is needed.

Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
Commit-message-mostly-authored-by: Claude Sonnet 3.7 (because why not -greg)
2025-03-02 18:01:45 -08:00
Brandt Bucher
7afa476874
GH-130415: Use boolean guards to narrow types to values in the JIT (GH-130659) 2025-03-02 13:21:34 -08:00
Bénédikt Tran
c6513f7a62
gh-128481: indicate that the default value for FrameSummary.end_lineno changed in 3.13 (#130755)
The value taken by `FrameSummary.end_lineno` when passing `end_lineno=None` changed in gh-112097.

Previously, a `end_lineno` could be specified to be `None` directly but since 939fc6d, passing None makes
the constructor use the value of `lineno` instead.
2025-03-02 18:16:51 +01:00
Kanishk Pachauri
a42168d316
gh-130637: Add validation for numeric response data in stat() method (#130646)
Co-authored-by: Eric V. Smith <ericvsmith@users.noreply.github.com>
2025-03-02 08:05:40 -05:00
Bénédikt Tran
990ad272f6
gh-89083: add support for UUID version 6 (RFC 9562) (#120650)
Add support for generating UUIDv6 objects according to RFC 9562, §5.6 [1].

The functionality is provided by the `uuid.uuid6()` function which takes as inputs an optional 48-bit
hardware address and an optional 14-bit clock sequence. The UUIDv6 temporal fields are ordered
differently than those of UUIDv1, thereby providing improved database locality.

[1]: https://www.rfc-editor.org/rfc/rfc9562.html#section-5.6

---------

Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
Co-authored-by: Victor Stinner <vstinner@python.org>
2025-03-02 12:41:56 +01:00
Hugo Beauzée-Luyssen
214562ed4d
gh-130740: Move some stdbool.h includes after Python.h (#130738)
Move some `#include <stdbool.h>` after `#include "Python.h"` when `pyconfig.h` is not
included first and when we are in a platform-agnostic context. This is to avoid having
features defined by `stdbool.h` before those decided by `Python.h`.
2025-03-02 09:56:49 +00:00
Damien
051f0e5683
gh-128481: Improve documentation for traceback.FrameSummary (#128484)
Complete the `traceback.FrameSummary` signature and add missing
documentation for the `colno` and `end_{col,line}no` attributes.
2025-03-02 10:29:12 +01:00
Arijit Kumar Das
37145cb89f
Fix grammar typo in Doc/c-api/arg.rst (#130741) 2025-03-02 10:24:34 +01:00
Tim Hoffmann
c71e55869e
Add link in the importlib.metadata.version() docs (#130739)
Link the specification for the returned data makes it clearer what this is
and what the format of the version string can be.
2025-03-02 10:23:32 +01:00
Barney Gale
c9932a9ec8
GH-127381: pathlib ABCs: remove WritablePath.mkdir() arguments (#130611)
Remove the *mode*, *parents* and *exist_ok* arguments from
`WritablePath.mkdir()`. These arguments imply support for POSIX permissions
and checking for preexistence of the path or its parents, but subclasses of
`WritablePath` may not have these capabilities.

The public `Path.mkdir()` method retains these arguments.
2025-03-01 21:25:38 +00:00
Barney Gale
a55dffd66d
GH-127381: pathlib ABCs: remove ReadablePath.exists() and is_*() (#130520)
Remove `ReadablePath` methods duplicated by `ReadablePath.info`. To be
specific, we remove `exists()`, `is_dir()`, `is_file()` and `is_symlink()`.

The public `Path` class retains these methods.
2025-03-01 21:24:19 +00:00
Apostol Fet
5181ddb29f
gh-130160: use .. program:: directive for documenting cProfile CLI (#130314)
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
2025-03-01 23:39:25 +03:00
Duprat
a98a6bd112
gh-129401: Test repr rlock failing randomly (#129959)
Fix and simplify a test of `test_repr_rlock` about multiprocessing.RLock primitive.
2025-03-01 15:28:14 -05:00
Barney Gale
5326c27fc6
Revert "GH-116380: Speed up glob.[i]glob() by making fewer system calls. (#116392)" (#130743)
This broke tests on the 'aarch64 Fedora Stable Clang Installed 3.x' and
'AMD64 Fedora Stable Clang Installed 3.x' build bots.

This reverts commit da4899b94a9a9083fed4972b2473546e0d997727.
2025-03-01 20:04:01 +00:00
Sam Gross
5221d9ce0e
Revert "gh-128364: Fix flaky test_timeout test (gh-130724)" (gh-130732)
Change broke Android and iOS buildbots that do not have multiprocessing.

This reverts commit cfa0b1dc375e63cde28e61a47108c645b0e74834.
2025-03-01 17:22:13 +00:00