Commit graph

53462 commits

Author SHA1 Message Date
Miss Islington (bot)
3930b7c258
[3.13] gh-131339: test PyBytes_Size for a zero-size bytes object (GH-131340) (#131343)
gh-131339: test PyBytes_Size for a zero-size bytes object (GH-131340)
(cherry picked from commit 3ae67ba97e)

Co-authored-by: Nybblista <170842536+nybblista@users.noreply.github.com>
2025-03-17 09:01:40 +00:00
Sam Gross
5646f6f739
[3.13] gh-130382: add missing _PyReftracerTrack to ceval Py_DECREF (GH-130689) (#131195)
(cherry picked from commit c5abded099)

Co-authored-by: Tomasz Pytel <tompytel@gmail.com>
2025-03-14 09:52:05 -04:00
Wulian233
130fa4c94f
[3.13] gh-131204: Fix difflib.HtmlDiff may not use monospaced font (GH-131221) (#131242)
(cherry picked from commit 7fd6160)
2025-03-14 12:27:13 +00:00
Miss Islington (bot)
a3ca70c527
[3.13] gh-131234: Improve test_popen with more asserts (GH-131235) (#131240)
gh-131234: Improve `test_popen` with more asserts (GH-131235)
(cherry picked from commit fc07f863ee)

Co-authored-by: sobolevn <mail@sobolevn.me>
2025-03-14 12:02:47 +00:00
Miss Islington (bot)
7d498aae2c
[3.13] gh-131219: Improve tests in test_lzma.py by adding more asserts (GH-131220) (#131231)
gh-131219: Improve tests in `test_lzma.py` by adding more asserts (GH-131220)
(cherry picked from commit f6c24a5c89)

Co-authored-by: sobolevn <mail@sobolevn.me>
2025-03-14 11:05:59 +00:00
Serhiy Storchaka
78f75d330a
[3.13] gh-85012: Properly reset msgctxt when compiling messages with msgfmt (GH-130525) (GH-131205)
Add also human-readable snapshots for tests.
(cherry picked from commit 7ea6e88eb4)

Co-authored-by: Tomas R <tomas.roun8@gmail.com>
2025-03-13 19:15:28 +00:00
Victor Stinner
050813c026
[3.13] gh-131032: Add support.linked_to_musl() function (#131071) (#131179)
gh-131032: Add support.linked_to_musl() function (#131071)

Skip test_math.test_fma_zero_result() if Python is linked to the musl
C library.

(cherry picked from commit 68922ace4d)
2025-03-13 09:59:57 +00:00
Russell Keith-Magee
589f422d1b
[3.13] gh-130940: Remove PyConfig.use_system_logger (#131129)
Removes ``PyConfig.use_system_logger``, resolving an ABI incompatibility introduced in
3.13.2.

Changes the default behavior of iOS to *always* direct stdout/stderr to the system log.
2025-03-13 11:53:11 +08:00
Miss Islington (bot)
65b58291b0
[3.13] gh-93096: Load doctests in test_itertools (GH-131133) (#131136)
gh-93096: Load doctests in `test_itertools` (GH-131133)
(cherry picked from commit 15a8412b5e)

Co-authored-by: donBarbos <donbarbos@proton.me>
2025-03-12 08:03:24 +00:00
Miss Islington (bot)
d23a0f2d86
[3.13] Use subTest() in math.fma() tests (GH-131125) (#131132)
Use subTest() in math.fma() tests (GH-131125)
(cherry picked from commit 52756c30db)

Co-authored-by: Sergey B Kirpichev <skirpichev@gmail.com>
2025-03-12 06:47:01 +00:00
Pablo Galindo Salgado
0980e2e370
[3.13] gh-117174: Fix reference leak and gdb tests (GH-131095) (#131120)
(cherry picked from commit ebc24d54bc)
2025-03-11 23:43:07 +00:00
Miss Islington (bot)
98c7ae3f7e
[3.13] gh-130957: Use sleeping_retry in test_free_reference (GH-130958) (#131091)
The weak reference may not be immediately dead.
(cherry picked from commit 1908115871)

Co-authored-by: Sam Gross <colesbury@gmail.com>
2025-03-11 14:14:28 +00:00
Victor Stinner
27fd328cf6
[3.13] gh-130959: Reject whitespace in fractions, in pure Python fromisoformat() (#130962) (#131076)
gh-130959: Reject whitespace in fractions, in pure Python `fromisoformat()` (#130962)

Fix the pure Python implementation of `fromisoformat()` to reject any
non-digit characters, including whitespace, in the fractional part
of time specification.  This makes the behavior consistent with the C
implementation, and prevents incorrect parsing of these fractions
(e.g. `.400 ` would be misinterpreted as `.04`).

Co-authored-by: Peter Bierma <zintensitydev@gmail.com>
Co-authored-by: Paul Ganssle <1377457+pganssle@users.noreply.github.com>
(cherry picked from commit 33494b4d0d)

Co-authored-by: Michał Górny <mgorny@gentoo.org>
2025-03-11 12:39:27 +01:00
Miss Islington (bot)
68a1591bec
[3.13] gh-93096: Fix loading doctests in test_pickle (GH-131069) (GH-131080)
(cherry picked from commit 3bb20d13a8)

Co-authored-by: donBarbos <donbarbos@proton.me>
2025-03-11 10:49:14 +00:00
Miss Islington (bot)
3e173e505a
[3.13] gh-130932: cwd cannot be removed on Solaris/Illumos (GH-131037) (#131073)
gh-130932: cwd cannot be removed on Solaris/Illumos (GH-131037)
(cherry picked from commit 69309a55bc)

Co-authored-by: Jakub Kulík <Kulikjak@gmail.com>
2025-03-11 09:33:50 +00:00
Miss Islington (bot)
c7022230d2
[3.13] gh-117174: Add a new route in linecache to fetch interactive source code (GH-117500) (#131060)
gh-117174: Add a new route in linecache to fetch interactive source code (GH-117500)
(cherry picked from commit a931a8b324)

Co-authored-by: Pablo Galindo Salgado <Pablogsal@gmail.com>
2025-03-10 23:11:24 +00:00
Miss Islington (bot)
ebd2ed7ad8
[3.13] gh-125331: Allow the parser to activate future imports on the fly (GH-125482) (#131062)
gh-125331: Allow the parser to activate future imports on the fly (GH-125482)
(cherry picked from commit 3bd3e09588)

Co-authored-by: Pablo Galindo Salgado <Pablogsal@gmail.com>
2025-03-10 22:20:38 +00:00
Miss Islington (bot)
977af3a6a2
[3.13] gh-124927: Fix conversion issue between coordinates and position in REPL (GH-125001) (#131061)
gh-124927: Fix conversion issue between coordinates and position in REPL (GH-125001)
(cherry picked from commit 6ab5c4aa05)

Co-authored-by: FeH2 <i@feh2.im>
2025-03-10 22:18:13 +00:00
Miss Islington (bot)
cf829f49de
[3.13] gh-131020: py.exe launcher does not correctly detect a BOM when searching for the shebang (GH-131021) (#131047)
gh-131020: py.exe launcher does not correctly detect a BOM when searching for the shebang (GH-131021)
(cherry picked from commit 36ef3bfe39)

Co-authored-by: Chris Eibl <138194463+chris-eibl@users.noreply.github.com>
2025-03-10 19:54:10 +00:00
Miss Islington (bot)
fead51d808
[3.13] gh-130954: Fix multiprocessing test_notify_n (GH-130955) (#130981)
The test could deadlock trying join on the worker processes.
Apply the same technique as gh-130933.

Join the process before the test ends in `test_notify` as well.
(cherry picked from commit edd1eca336)

Co-authored-by: Sam Gross <colesbury@gmail.com>
2025-03-08 18:28:07 +00:00
Miss Islington (bot)
597a953484
[3.13] gh-130917: update timer and workload in test_signal (GH-130918) (#130969)
The workload to advance the virtual timeout is too lightweight for some
platforms. As result the test goes in timeout as it never reaches the
end of the timer. By having a heavier workload, the virtual timer
advances rapidly and the SIGVTALRM is sent before the timeout.
(cherry picked from commit 7879081198)

Co-authored-by: Diego Russo <diego.russo@arm.com>
2025-03-08 01:05:29 +00:00
Miss Islington (bot)
94b94d0b12
[3.13] gh-110206: Fix multiprocessing test_notify_all (GH-130933) (#130950)
The test could deadlock trying join on the worker processes due to a
combination of behaviors:

* The use of `assertReachesEventually` did not ensure that workers
  actually woken.release() because the SyncManager's Semaphore does not
  implement get_value.

* This mean that the test could finish and the variable "sleeping" would
  got out of scope and be collected. This unregisters the proxy leading
  to failures in the worker or possibly the manager.

* The subsequent call to `p.join()` during cleanUp therefore never
  finished.

This takes two approaches to fix this:

1) Use woken.acquire() to ensure that the workers actually finish
   calling woken.release()

2) At the end of the test, wait until the workers are finished, while `cond`,
   `sleeping`, and `woken` are still valid.
(cherry picked from commit c476410dc5)

Co-authored-by: Sam Gross <colesbury@gmail.com>
2025-03-07 12:22:51 -05:00
Miss Islington (bot)
d5eb490846
[3.13] gh-130932: Fix incorrect exception handling in _PyModule_IsPossiblyShadowing (GH-130934) (#130939)
gh-130932: Fix incorrect exception handling in _PyModule_IsPossiblyShadowing (GH-130934)

I chose to not raise an exception here because I think it would be
confusing for module attribute access to start raising something other
than AttributeError if e.g. the cwd goes away

Without the change in moduleobject.c
```
./python.exe -m unittest test.test_import.ImportTests.test_script_shadowing_stdlib_cwd_failure
...
Assertion failed: (PyErr_Occurred()), function _PyObject_SetAttributeErrorContext, file object.c, line 1253.
```
(cherry picked from commit 0a9ae5ed48)

Co-authored-by: Shantanu <12621235+hauntsaninja@users.noreply.github.com>
2025-03-07 09:28:47 +00:00
Sam Gross
0c088e4442
[3.13] gh-128364: Fix flaky test_concurrent_futures.test_wait tests (gh-130742) (#130922)
Use events instead of relying on `time.sleep()`. The tests are also now about
four times faster.
(cherry picked from commit c4d37eefb7)
2025-03-06 13:49:03 -05:00
Miss Islington (bot)
e285232c76
[3.13] gh-130851: Don't crash when deduping unusual code constants (GH-130853) (#130880)
The bytecode compiler only generates a few different types of constants,
like str, int, tuple, slices, etc. Users can construct code objects with
various unusual constants, including ones that are not hashable or not
even constant.

The free threaded build previously crashed with a fatal error when
confronted with these constants. Instead, treat distinct objects of
otherwise unhandled types as not equal for the purposes of deduplication.
(cherry picked from commit 2905690a91)

Co-authored-by: Sam Gross <colesbury@gmail.com>
2025-03-05 15:22:57 -05:00
Miss Islington (bot)
39f7b06d35
[3.13] gh-127371 Avoid unbounded growth SpooledTempfile.writelines (GH-127372) (#130886)
gh-127371 Avoid unbounded growth SpooledTempfile.writelines (GH-127372)
(cherry picked from commit cb67b44ca9)

Co-authored-by: Bert Peters <bert@bertptrs.nl>
2025-03-05 18:42:55 +01:00
Miss Islington (bot)
aa2c4e4417
[3.13] gh-116742: Fix subprocess test_check_output_timeout() (GH-130836) (#130873)
gh-116742: Fix subprocess test_check_output_timeout() (GH-130836)

Fix a race condition in test_check_output_timeout() of
test_subprocess. Don't write into stdout anymore, since there is no
reliable way to synchronize the parent and the child processes.

Change the timeout from 3 seconds to 0.1 seconds, and remove
@requires_resource('walltime') decorator.
(cherry picked from commit 67a942d427)

Co-authored-by: Victor Stinner <vstinner@python.org>
2025-03-05 13:01:06 +01:00
Miss Islington (bot)
6321e1ab4b
[3.13] gh-130824: Add tests for NULL in PyLong_*AndOverflow functions (GH-130828) (GH-130869)
(cherry picked from commit 90130807d9)

Co-authored-by: Peter Bierma <zintensitydev@gmail.com>
Co-authored-by: Sergey B Kirpichev <skirpichev@gmail.com>
2025-03-05 13:51:52 +02:00
Miss Islington (bot)
22d729cf5d
[3.13] gh-130730: Fix multiprocessing test_active_children() (GH-130837) (#130845)
gh-130730: Fix multiprocessing test_active_children() (GH-130837)

Replace a sleep with an event: sleep is not a reliable
synchronization primitive.
(cherry picked from commit 3dd3675492)

Co-authored-by: Victor Stinner <vstinner@python.org>
2025-03-04 17:28:33 +00:00
Miss Islington (bot)
a115480f71
[3.13] gh-130727: Retry test_wmi on TimeoutError (GH-130832) (#130839)
gh-130727: Retry test_wmi on TimeoutError (GH-130832)

Use sleeping_retry() in test_wmi to retry multiple times on
TimeoutError. Wait up to LONG_TIMEOUT seconds (5 minutes by default).
(cherry picked from commit f67ff9e820)

Co-authored-by: Victor Stinner <vstinner@python.org>
2025-03-04 15:31:22 +00:00
Miss Islington (bot)
39dc7a1af2
[3.13] gh-130736: Fix asyncio test_shutdown_default_executor_timeout() (GH-130800) (#130825)
gh-130736: Fix asyncio test_shutdown_default_executor_timeout() (GH-130800)

Replace time.sleep() with threading.Event.
(cherry picked from commit 6c48ed7d62)

Co-authored-by: Victor Stinner <vstinner@python.org>
2025-03-04 17:41:31 +05:30
Miss Islington (bot)
d00e92bc04
[3.13] gh-130737: Fix multiprocessing test_notify() (GH-130797) (#130802)
gh-130737: Fix multiprocessing test_notify() (GH-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).
(cherry picked from commit 8a64a62002)

Co-authored-by: Victor Stinner <vstinner@python.org>
2025-03-03 19:09:34 +00:00
Miss Islington (bot)
4c6318e24d
[3.13] gh-128388: pyrepl on Windows: add meta and ctrl+arrow keybindings (GH-128389) (GH-130500)
gh-128388: pyrepl on Windows: add meta and ctrl+arrow keybindings (GH-128389)

Fix `Lib/_pyrepl/windows_console.py` to support more keybindings, like the
`Ctrl`+`←` and `Ctrl`+`→` word-skipping keybindings and those with meta (i.e. Alt),
e.g. to `kill-word` or `backward-kill-word`.

Specifics: if Ctrl is pressed, emit "ctrl left" and "ctrl right" instead of just "left" or
"right," and if Meta/Alt is pressed, emit the special key code for meta before
emitting the other key that was pressed.
(cherry picked from commit 688f3a0d4b)

Co-authored-by: Paulie Peña <203125+paulie4@users.noreply.github.com>
Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
Co-authored-by: Pieter Eendebak <pieter.eendebak@gmail.com>
2025-03-03 16:57:53 +01:00
Miss Islington (bot)
bc5c2b8573
[3.13] gh-130379: Fix incorrect zipapp logic to avoid including the target in itself (gh-130509) (gh-130791)
gh-130379: Fix incorrect zipapp logic to avoid including the target in itself (gh-130509)
(cherry picked from commit 64ccbbbf36)

Co-authored-by: Paul Moore <p.f.moore@gmail.com>
2025-03-03 15:20:05 +00:00
Miss Islington (bot)
e6dfa9d601
[3.13] gh-130637: Add validation for numeric response data in stat() method (GH-130646) (#130763)
gh-130637: Add validation for numeric response data in `stat()` method (GH-130646)
(cherry picked from commit a42168d316)

Co-authored-by: Kanishk Pachauri <itskanishkp.py@gmail.com>
Co-authored-by: Eric V. Smith <ericvsmith@users.noreply.github.com>
2025-03-02 20:28:56 +00:00
Pablo Galindo Salgado
2d7145decb
[3.13] gh-130618: Fix parser error when using lambdas inside f-strings (GH-130638) (#130642)
(cherry picked from commit e06bebb87e)

Signed-off-by: Pablo Galindo <pablogsal@gmail.com>
2025-03-01 18:10:03 +00:00
Miss Islington (bot)
a0ea87c0c3
[3.13] Revert "gh-128364: Fix flaky test_timeout test (gh-130724)" (gh-130732) (#130734)
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 cfa0b1dc37.
(cherry picked from commit 5221d9ce0e)

Co-authored-by: Sam Gross <colesbury@gmail.com>
2025-03-01 17:44:50 +00:00
Miss Islington (bot)
5070864e16
[3.13] gh-128364: Fix flaky test_timeout test (gh-130724) (gh-130728)
gh-128364: Fix flaky `test_timeout` test (gh-130724)
(cherry picked from commit cfa0b1dc37)

Co-authored-by: Sam Gross <colesbury@gmail.com>
2025-03-01 16:46:58 +00:00
Miss Islington (bot)
9d825d4281
[3.13] gh-130607: Extend and cleanup IPv6 tests (GH-121518) (GH-130679)
Extend IPv6 tests and made little syntax refactoring
(cherry picked from commit 9f0879baf1)

Co-authored-by: Ilya Bazhenov <31971067+bazhil@users.noreply.github.com>
2025-02-28 12:41:41 +01:00
Miss Islington (bot)
b223dc70cd
[3.13] gh-130655: Increase test coverage of gettext._expand_lang() (GH-130656) (GH-130671)
(cherry picked from commit 24c52cb14c)

Co-authored-by: Tomas R <tomas.roun8@gmail.com>
2025-02-28 09:02:18 +00:00
Miss Islington (bot)
ad97027e9b
[3.13] gh-129726: Break gzip.GzipFile reference loop (GH-130055) (#130669)
gh-129726: Break `gzip.GzipFile` reference loop (GH-130055)

A reference loop was resulting in the `fileobj` held by the `GzipFile`
being closed before the `GzipFile`.

The issue started with gh-89550 in 3.12, but was hidden in most cases
until 3.13 when gh-62948 made it more visible.
(cherry picked from commit 7f39137662)

Co-authored-by: Cody Maloney <cmaloney@users.noreply.github.com>
2025-02-28 08:32:44 +00:00
Hugo van Kemenade
4100fb0537
[3.13] GH-92897: schedule the check_home deprecation to 3.15 (GH-129102) (#130583)
Co-authored-by: Filipe Laíns 🇵🇸 <lains@riseup.net>
2025-02-27 18:16:33 +00:00
Adam Turner
93b2bcb52d
[3.13] GH-121970: Extract pydoc_topics into a new extension (#129116) (#130441)
Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
2025-02-27 14:18:46 +00:00
Sam Gross
9966daee60
[3.13] gh-117657: Enable test_opcache under TSAN (GH-129831) (GH-130597)
Fix a few thread-safety bugs to enable test_opcache when run with TSAN:

 * Use relaxed atomics when clearing `ht->_spec_cache.getitem`
   (gh-115999)
 * Add temporary suppression for type slot modifications (gh-127266)
 * Use atomic load when reading `*dictptr`

(cherry picked from commit f151d27159)
2025-02-26 13:59:59 -05:00
Miss Islington (bot)
43a2a372ba
[3.13] GH-130396: Treat clang -Og as optimized for gdb tests (GH-130550) (#130572)
GH-130396: Treat clang -Og as optimized for gdb tests (GH-130550)
(cherry picked from commit 129db32d6f)

Co-authored-by: Mark Shannon <mark@hotpy.org>
2025-02-26 11:37:43 +00:00
Serhiy Storchaka
7c1b76fce8
[3.13] gh-130163: Fix crashes related to PySys_GetObject() (GH-130503) (GH-130556)
The use of PySys_GetObject() and _PySys_GetAttr(), which return a borrowed
reference, has been replaced by using one of the following functions, which
return a strong reference and distinguish a missing attribute from an error:
_PySys_GetOptionalAttr(), _PySys_GetOptionalAttrString(),
_PySys_GetRequiredAttr(), and _PySys_GetRequiredAttrString().
(cherry picked from commit 0ef4ffeefd)
2025-02-25 22:50:26 +00:00
Miss Islington (bot)
b0d3f49195
[3.13] Fix a typo in code module test (GH-130530) (#130534)
Fix a typo in code module test (GH-130530)
(cherry picked from commit 56e337d32b)

Co-authored-by: Tian Gao <gaogaotiantian@hotmail.com>
2025-02-25 17:38:40 +00:00
Miss Islington (bot)
d71b167c5c
[3.13] gh-129405: Fix doc for Py_mod_multiple_interpreters default, and add test (GH-129406) (GH-130507)
(cherry picked from commit fc8d2cba54)

Co-authored-by: Petr Viktorin <encukou@gmail.com>
2025-02-24 16:49:35 +01:00
Xuanteng Huang
bb6f3c3769
[3.13] gh-128714: Fix function object races in __annotate__, __annotations__ and __type_params__ in free-threading build (GH-129016) (#129729)
* gh-128714: Fix function object races in `__annotate__`, `__annotations__` and `__type_params__` in  free-threading build (#129016)

(cherry picked from commit 55f17b77c3)

---------

Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
2025-02-23 21:49:55 -05:00
Miss Islington (bot)
6abec03aef
[3.13] Add test checking value of a TypedDict's __total__ attribute when there is an assignment in the class body. (GH-130460) (#130462)
Add test checking value of a TypedDict's __total__ attribute when there is an assignment in the class body. (GH-130460)

In relation to GH-109544 which changed this behavior.
(cherry picked from commit d8ce092fe4)

Signed-off-by: Daniel Sperber <github.blurry@9ox.net>
Co-authored-by: Daraan <github.blurry@9ox.net>
2025-02-22 18:33:20 +00:00