Commit graph

30968 commits

Author SHA1 Message Date
Miss Islington (bot)
65a01034e6
[3.12] gh-130655: Add tests for gettext.find() (GH-130691) (#132083)
gh-130655: Add tests for `gettext.find()` (GH-130691)

(cherry picked from commit 3118693a1a)

Co-authored-by: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com>
Co-authored-by: Tomas R. <tomas.roun8@gmail.com>
2025-04-04 16:39:22 +02:00
Tomas R.
da7ac18c9d
[3.12] gh-130197: pygettext: Test the --escape option (GH-131902) (GH-132033)
(cherry picked from commit 87d9983994)
2025-04-02 23:29:02 +03:00
Serhiy Storchaka
6f6b8b4ac9
[3.12] gh-89039: Call subclass constructors in datetime.*.replace (GH-114780) (GH-131239)
When replace() method is called on a subclass of datetime, date or time,
properly call derived constructor. Previously, only the base class's
constructor was called.

Also, make sure to pass non-zero fold values when creating subclasses in
various methods. Previously, fold was silently ignored.
(cherry picked from commit 46190d9ea8)

Co-authored-by: Eugene Toder <eltoder@users.noreply.github.com>
2025-04-02 20:35:16 +03:00
Miss Islington (bot)
e4fe4d9d53
[3.12] gh-131888: fix ResourceWarning in test_ftplib (GH-131889) (#132010)
gh-131888: fix ResourceWarning in test_ftplib (GH-131889)
(cherry picked from commit b0f77c4d25)

Co-authored-by: Thomas Grainger <tagrain@gmail.com>
2025-04-02 12:46:40 +00:00
Miss Islington (bot)
b3cf1f27e9
[3.12] gh-132002: Fix crash of ContextVar on unhashable str subtype (GH-132003) (#132008)
gh-132002: Fix crash of `ContextVar` on unhashable `str` subtype (GH-132003)
(cherry picked from commit ab2a3dda1d)

Co-authored-by: sobolevn <mail@sobolevn.me>
2025-04-02 12:05:30 +00:00
Miss Islington (bot)
756676fc18
[3.12] gh-131736: only apply security_level workaround in test_ssl for security levels greater than 1 (GH-131739) (#131966)
gh-131736: only apply `security_level` workaround in `test_ssl` for security levels greater than 1 (GH-131739)
(cherry picked from commit 3b3720f1a2)

Co-authored-by: Will Childs-Klein <willck93@gmail.com>
2025-04-01 08:16:34 +00:00
Miss Islington (bot)
5d4e891411
[3.12] gh-126033: fix UAF in xml.etree.ElementTree.Element.remove when concurrent mutations happen (GH-126124) (#131930)
gh-126033: fix UAF in `xml.etree.ElementTree.Element.remove` when concurrent mutations happen (GH-126124)
(cherry picked from commit bab1398a47)

Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
2025-03-31 14:50:13 +02:00
Bénédikt Tran
f1689b61fe
[3.12] gh-126037: fix UAF in xml.etree.ElementTree.Element.find* when concurrent mutations happen (#127964) (#131932)
gh-126037: fix UAF in `xml.etree.ElementTree.Element.find*` when concurrent mutations happen (#127964)

We fix a use-after-free in the `find`, `findtext` and `findall` methods of `xml.etree.ElementTree.Element`
objects that can be triggered when the tag to find implements an `__eq__` method that mutates the
element being queried.

(cherry picked from commit c57623c221)
2025-03-31 14:47:22 +02:00
Miss Islington (bot)
85b6b0e2d2
[3.12] gh-131050: skip test_dh_params when TLS library lacks FFDHE ciphersuites (GH-131051) (#131875)
gh-131050: skip `test_dh_params` when TLS library lacks FFDHE ciphersuites (GH-131051)
(cherry picked from commit be2d2181e6)

Co-authored-by: Will Childs-Klein <willck93@gmail.com>
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
2025-03-29 10:51:11 +00:00
Steve Dower
dfb63723d2
gh-131423: Update to OpenSSL 3.0.16. (GH-131839)
The bin tag is 3.0.16.1 because we rebuilt without uplink support to fix gh-131804.
This PR also prevents making calls that are now unsafe without uplink, and updates
the tests to property interpret these failures as unsupported.
2025-03-28 15:29:20 +00:00
Miss Islington (bot)
7d447ac4e0
[3.12] gh-131807: fix ResourceWarning in test_ucn.py (GH-131808) (#131846)
gh-131807: fix ResourceWarning in test_ucn.py (GH-131808)
(cherry picked from commit adb67ed7e4)

Co-authored-by: Thomas Grainger <tagrain@gmail.com>
Co-authored-by: Victor Stinner <vstinner@python.org>
2025-03-28 15:12:59 +00:00
Miss Islington (bot)
d4ddc03e56
[3.12] gh-127949: fix resource warnings in test_tasks.py (GH-128172) (#131806)
* gh-127949: fix resource warnings in `test_tasks.py` (GH-128172)
(cherry picked from commit b66a4ad9fc)

Co-authored-by: Thomas Grainger <tagrain@gmail.com>
Co-authored-by: Kumar Aditya <kumaraditya@python.org>
2025-03-28 14:25:39 +00:00
Miss Islington (bot)
1826347d9d
[3.12] gh-131649: fix test_string_literals SyntaxWarning (GH-131650) (GH-131766) (#131772)
[3.13] gh-131649: fix test_string_literals SyntaxWarning (GH-131650) (GH-131766)

(cherry picked from commit 2d83891dfd)
(cherry picked from commit 5bcb476df1)

Co-authored-by: Brian Schubert <brianm.schubert@gmail.com>
Co-authored-by: Thomas Grainger <tagrain@gmail.com>
2025-03-26 16:47:55 +00:00
Miss Islington (bot)
e78280d0de
[3.12] gh-131677: Fix flaky test_lru_cache_threaded3 (gh-131679) (gh-131693)
The call to `with self.subTest(...)` was not thread-safe.
(cherry picked from commit a123245986)

Co-authored-by: Sam Gross <colesbury@gmail.com>
2025-03-24 20:59:03 +00:00
Miss Islington (bot)
76e911a040
[3.12] gh-131670: Fix crash in anext() when __anext__ is sync and raises (GH-131682) (#131687)
gh-131670: Fix crash in `anext()` when `__anext__` is sync and raises (GH-131682)
(cherry picked from commit 929afd1d6e)

Co-authored-by: sobolevn <mail@sobolevn.me>
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
2025-03-24 19:18:29 +00:00
Bénédikt Tran
8a9aee7126
[3.12] gh-131045: [Enum] fix flag containment checks when using values (GH-131053) (#131232)
* gh-131045: [Enum] fix flag containment checks when using values (GH-131053)

Check would fail if value would create a pseudo-member, but that member
had not yet been created.  We now attempt to create a pseudo-member for
a passed-in value first.

---------

Co-authored-by: Ethan Furman <ethan@stoneleaf.us>
Co-authored-by: Tomas R. <tomas.roun8@gmail.com>
2025-03-24 10:31:24 +01:00
Nybblista
7f2de07808
[3.12] gh-131357: Add a set of asserts to test.test_capi.test_bytearray (GH-131554) (#131629)
[3.12] gh-131357: Add a set of asserts to test.test_capi.test_bytearray (#131554)

add a set of asserts to test.test_capi.test_bytearray

1. Assert empty bytearray object for PyByteArray_Check.
2. Assert empty bytearray object for PyByteArray_CheckExact.
3. Assert 0-size bytearray object for PyByteArray_Size.
4. Assert empty bytearray object for PyByteArray_AsString.
5. Assert concatenation of the bytearray object with itself for PyByteArray_Concat.

(cherry picked from commit f3bf304c27)
2025-03-23 17:43:12 +00:00
Miss Islington (bot)
2d6a778f73
[3.12] gh-131492, gh-131461: handle exceptions in GzipFile constructor while owning resources (GH-131462) (#131519)
(cherry picked from commit ce79274e9f)

Co-authored-by: Thomas Grainger <tagrain@gmail.com>
Co-authored-by: Victor Stinner <vstinner@python.org>
2025-03-21 11:21:40 +01:00
Nybblista
30e38b9dc6
[3.12] gh-131441: Add a set of asserts to test.test_capi.test_list (#131442) (#131533)
gh-131441: Add a set of asserts to test.test_capi.test_list (#131442)

(cherry picked from commit 2433cc79d7)
2025-03-21 10:56:21 +03:00
Miss Islington (bot)
5dfb5e640e
[3.12] gh-121284: Fix email address header folding with parsed encoded-word (GH-122754) (#131404)
gh-121284: Fix email address header folding with parsed encoded-word (GH-122754)

Email generators using email.policy.default may convert an RFC 2047
encoded-word to unencoded form during header refolding. In a structured
header, this could allow 'specials' chars outside a quoted-string,
leading to invalid address headers and enabling spoofing. This change
ensures a parsed encoded-word that contains specials is kept as an
encoded-word while the header is refolded.

[Better fix from @bitdancer.]

---------
(cherry picked from commit 295b53df2a)

Co-authored-by: Mike Edmunds <medmunds@gmail.com>
Co-authored-by: R David Murray <rdmurray@bitdance.com>
Co-authored-by: Petr Viktorin <encukou@gmail.com>
2025-03-18 15:35:32 -04:00
Bénédikt Tran
865bd6de99
[3.12] gh-131277: allow EnvironmentVarGuard to unset more than one environment variable at once (GH-131280) (#131410)
(cherry picked from commit 3185e3115c)

---------

Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
2025-03-18 13:46:24 +01:00
Miss Islington (bot)
18e4eb410a
[3.12] gh-130727: Retry test_wmi on TimeoutError (GH-130832) (#130840)
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-17 15:57:28 +00:00
Miss Islington (bot)
6e7432f130
[3.12] gh-131339: test PyBytes_Size for a zero-size bytes object (GH-131340) (#131344)
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 12:20:32 +00:00
Wulian233
e364a4212e
[3.12] gh-131204: Fix difflib.HtmlDiff may not use monospaced font (GH-131221) (#131243)
(cherry picked from commit 7fd6160)
2025-03-14 12:23:39 +00:00
Miss Islington (bot)
9a612a850c
[3.12] gh-131234: Improve test_popen with more asserts (GH-131235) (#131241)
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 11:54:56 +00:00
sobolevn
6658ada1ea
[3.12] gh-131219: Improve tests in test_lzma.py by adding more asserts (GH-131220) (#131237)
Co-authored-by: sobolevn <mail@sobolevn.me>
2025-03-14 11:54:37 +00:00
Serhiy Storchaka
a3f4889413
[3.12] gh-85012: Properly reset msgctxt when compiling messages with msgfmt (GH-130525) (GH-131206)
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:09:42 +00:00
Miss Islington (bot)
969631aec9
[3.12] gh-93096: Load doctests in test_itertools (GH-131133) (#131137)
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:00:17 +00:00
Miss Islington (bot)
afffd97cd9
[3.12] gh-130957: Use sleeping_retry in test_free_reference (GH-130958) (#131092)
The weak reference may not be immediately dead.
(cherry picked from commit 1908115871)

Co-authored-by: Sam Gross <colesbury@gmail.com>
2025-03-11 10:13:41 -04:00
Miss Islington (bot)
8f26a79b33
gh-130959: Reject whitespace in fractions, in pure Python fromisoformat() (GH-130962) (GH-131076) (#131086)
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`).

(cherry picked from commit 33494b4d0d)
(cherry picked from commit 27fd328cf6)

Co-authored-by: Victor Stinner <vstinner@python.org>
Co-authored-by: Michał Górny <mgorny@gentoo.org>
2025-03-11 12:00:06 +00:00
Miss Islington (bot)
bfad0b56d9
[3.12] gh-93096: Fix loading doctests in test_pickle (GH-131069) (GH-131081)
(cherry picked from commit 3bb20d13a8)

Co-authored-by: donBarbos <donbarbos@proton.me>
2025-03-11 10:42:47 +00:00
Kyle Cutler
33605da91c
[3.12] gh-130809: Fix PyFrame_LocalsToFast copying the wrong value (#130816)
* gh-130809: Fix `PyFrame_LocalsToFast` copying the wrong value

* Skip hidden locals

* test, blurb

* Update Misc/NEWS.d/next/Core_and_Builtins/2025-03-04-12-52-21.gh-issue-130809.fSXq60.rst

Co-authored-by: Tian Gao <gaogaotiantian@hotmail.com>

* Update test

* PR feedback

* formatting

* comment

---------

Co-authored-by: Tian Gao <gaogaotiantian@hotmail.com>
2025-03-10 20:27:07 -04:00
Miss Islington (bot)
fcf1f57d91
[3.12] gh-125331: Allow the parser to activate future imports on the fly (GH-125482) (#131063)
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:13:59 +00:00
Miss Islington (bot)
22ac71dc8e
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 20:12:40 +00:00
Miss Islington (bot)
a69107b335
[3.12] gh-130917: update timer and workload in test_signal (GH-130918) (#130968)
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 18:21:46 +00:00
Miss Islington (bot)
4eb4785afd
[3.12] gh-130954: Fix multiprocessing test_notify_n (GH-130955) (#130982)
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:21:37 +00:00
Miss Islington (bot)
4230697886
[3.12] gh-110206: Fix multiprocessing test_notify_all (GH-130933) (#130951)
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:20:00 -05:00
Miss Islington (bot)
397e69d009
[3.12] gh-127371 Avoid unbounded growth SpooledTempfile.writelines (GH-127372) (#130885)
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:35 +01:00
Miss Islington (bot)
ed015d05f2
[3.12] gh-116742: Fix subprocess test_check_output_timeout() (GH-130836) (#130874)
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:00:41 +01:00
Petr Viktorin
8fe011af38
[3.12] gh-130824: Add tests for NULL in PyLong_*AndOverflow functions (GH-130828) (GH-130876)
(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:52:40 +02:00
Miss Islington (bot)
45e667c7c2
[3.12] gh-130730: Fix multiprocessing test_active_children() (GH-130837) (#130846)
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:22:12 +00:00
Miss Islington (bot)
a0ac4dbe88
[3.12] gh-130736: Fix asyncio test_shutdown_default_executor_timeout() (GH-130800) (#130826)
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:00 +05:30
Miss Islington (bot)
519dec97e7
[3.12] gh-130737: Fix multiprocessing test_notify() (GH-130797) (#130803)
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:02:20 +00:00
Miss Islington (bot)
d9ca98a92d
[3.12] gh-130637: Add validation for numeric response data in stat() method (GH-130646) (#130764)
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 15:05:46 -05:00
Pablo Galindo Salgado
0860d9c72f
[3.12] gh-130618: Fix parser error when using lambdas inside f-strings (GH-130638) (#130644)
(cherry picked from commit e06bebb87e)
2025-03-01 18:10:07 +00:00
Miss Islington (bot)
99e18abe6f
[3.12] Revert "gh-128364: Fix flaky test_timeout test (gh-130724)" (gh-130732) (#130735)
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:40:51 +00:00
Miss Islington (bot)
27f9f2b98a
[3.12] gh-128364: Fix flaky test_timeout test (gh-130724) (gh-130729)
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:40:53 +00:00
Miss Islington (bot)
d922aa80fd
[3.12] gh-130607: Extend and cleanup IPv6 tests (GH-121518) (GH-130678)
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:34 +01:00
Miss Islington (bot)
aa91a11c40
[3.12] gh-130655: Increase test coverage of gettext._expand_lang() (GH-130656) (GH-130672)
(cherry picked from commit 24c52cb14c)

Co-authored-by: Tomas R <tomas.roun8@gmail.com>
2025-02-28 08:58:09 +00:00
Miss Islington (bot)
500ea3b0ee
[3.12] gh-129726: Break gzip.GzipFile reference loop (GH-130055) (#130670)
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:28:14 +00:00