Commit graph

33958 commits

Author SHA1 Message Date
Miss Islington (bot)
1a4f92b9fb
[3.14] gh-135640: Adds more type checking to ElementTree (GH-135643) (GH-136225)
(cherry picked from commit e0245c789f)

Co-authored-by: Kira <kirawhoprograms@fastmail.com>
2025-07-03 08:15:01 +00:00
Miss Islington (bot)
5216a6c547
[3.14] gh-135836: Fix IndexError in asyncio.create_connection() (GH-135875) (#136221)
gh-135836: Fix `IndexError` in `asyncio.create_connection()` (GH-135875)
(cherry picked from commit 9084b15156)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2025-07-03 04:34:30 +00:00
Miss Islington (bot)
8810ccfc60
[3.14] gh-135836: Fix IndexError in asyncio.create_connection with empty exceptions list (GH-135845) (#136167)
gh-135836: Fix `IndexError` in `asyncio.create_connection` with empty exceptions list (GH-135845)
(cherry picked from commit 0e19db653d)

Co-authored-by: heliang666s <147408835+heliang666s@users.noreply.github.com>
Co-authored-by: Kumar Aditya <kumaraditya@python.org>
2025-07-03 09:37:18 +05:30
Miss Islington (bot)
8ba024ddf5
[3.14] gh-134280: Disable constant folding for ~ with a boolean argument (GH-134982) (GH-136185)
This moves the deprecation warning from compile time to run time.
(cherry picked from commit 86c3316183)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2025-07-02 11:28:09 +03:00
Miss Islington (bot)
5e09d1913b
[3.14] gh-87298: Add tests for find_in_strong_cache() bug in _zoneinfo (GH-24829) (GH-136181)
(cherry picked from commit 12ce16bc13)

Co-authored-by: Zackery Spytz <zspytz@gmail.com>
Co-authored-by: Paul Ganssle <p.ganssle@gmail.com>
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2025-07-01 15:20:53 +00:00
Miss Islington (bot)
028901e97f
[3.14] gh-133982: Use implementation-specific open in test_fileio.OtherFileTests (GH-135364) (GH-136148)
gh-133982: Use implementation-specific `open` in `test_fileio.OtherFileTests` (GH-135364)
(cherry picked from commit 23caccf74c)

Co-authored-by: Cody Maloney <cmaloney@users.noreply.github.com>
2025-06-30 22:23:34 +00:00
Miss Islington (bot)
5e65cbbe64
[3.14] Doc: fix duplicated words (GH-136086) (#136108)
Doc: fix duplicated words (GH-136086)

---------
(cherry picked from commit 698bab5a40)

Co-authored-by: Weilin Du <108666168+LamentXU123@users.noreply.github.com>
Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
2025-06-29 18:45:26 -04:00
Pablo Galindo Salgado
c66b54f361
[3.14] gh-91048: Fix external inspection multi-threaded performance (GH-136005) (#136080)
(cherry picked from commit 5334732f9c)
2025-06-28 19:12:54 +01:00
Bénédikt Tran
c9c51bd770
[3.14] gh-135571: Guard _hashlib usage in test_hashlib.py (GH-135572) (#136042)
(cherry picked from commit 065194c1a9)

Co-authored-by: Will Childs-Klein <willck93@gmail.com>
2025-06-28 10:15:39 +02:00
Miss Islington (bot)
3bd4a49201
[3.14] gh-136028: Fix parsing month names containing "İ" (U+0130) in strptime() (GH-136029) (GH-136037)
This affects locales az_AZ, ber_DZ, ber_MA and crh_UA.
(cherry picked from commit 731f5b8ab3)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2025-06-27 14:12:15 +00:00
Miss Islington (bot)
1b218680b7
[3.14] gh-78465: Fix error message for cls.__new__(cls, ...) where cls is not instantiable (GH-135981) (GH-136030)
Previous error message suggested to use cls.__new__(), which
obviously does not work. Now the error message is the same as for
cls(...).
(cherry picked from commit c45f4f3ebe)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2025-06-27 12:01:48 +00:00
Miss Islington (bot)
33c83cea07
[3.14] gh-128051: Fix tests if sys.float_repr_style is 'legacy' (GH-135908) (#136025)
gh-128051: Fix tests if sys.float_repr_style is 'legacy' (GH-135908)
(cherry picked from commit f3aec60d7a)

Co-authored-by: Sergey B Kirpichev <skirpichev@gmail.com>
Co-authored-by: Victor Stinner <vstinner@python.org>
2025-06-27 10:26:51 +00:00
Miss Islington (bot)
a168c77536
[3.14] gh-53203: Fix strptime() for %c, %x and %X formats on some locales (GH-135971) (GH-136019)
* Add detection of decimal non-ASCII alt digits.
* Add support of non-decimal alt digits on locale lzh_TW.
* Accept only numbers in correct range if alt digits are known.
* Fix bug in detecting the position of the week day name on locales byn_ER and wal_ET.
* Fix support of single-digit hour on locales ar_SA and bg_BG.
* Add support for %T, %R, %r, %C, %OC.
* Prepare code to use nl_langinfo().

(cherry picked from commit 07183ebce3)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2025-06-27 08:16:31 +00:00
Miss Islington (bot)
2045453171
[3.14] gh-129958: New syntax error in format spec applies to both f-strings and t-strings (GH-135570) (#135982)
(cherry picked from commit fb9e292919)

Co-authored-by: Dylan <dylwil3@gmail.com>
Co-authored-by: Tomas R. <tomas.roun8@gmail.com>
Co-authored-by: Lysandros Nikolaou <lisandrosnik@gmail.com>
2025-06-26 18:40:09 +02:00
Miss Islington (bot)
c8e914cfb5
[3.14] gh-135721: skip test_trashcan_python_class on wasm buildbots with stack overflow (GH-135766) (GH-135955)
gh-135721: skip `test_trashcan_python_class` on wasm buildbots with stack overflow (GH-135766)
(cherry picked from commit 3fb6cfe7a9)

Co-authored-by: Pastukhov Nikita <diementros@yandex.ru>
2025-06-25 23:02:39 +00:00
Miss Islington (bot)
df1c124240
[3.14] gh-91555: Revert disabling of logger while handling log record. (GH-135858) (GH-135910)
Co-authored-by: Vinay Sajip <vinay_sajip@yahoo.co.uk>
2025-06-25 18:03:13 +01:00
Miss Islington (bot)
090a42b5eb
[3.14] gh-135855: Raise TypeError When Passing Non-dict Object to _interpreters.set___main___attrs (gh-135900)
(cherry picked from commit 4e6f0d116, AKA gh-135856)

Co-authored-by: Brian Schubert <brianm.schubert@gmail.com>
2025-06-24 19:19:31 +00:00
Miss Islington (bot)
3cdb659a0c
[3.14] gh-135487: fix reprlib.Repr.repr_int when given very large integers (GH-135506) (#135887)
gh-135487: fix `reprlib.Repr.repr_int` when given very large integers (GH-135506)
(cherry picked from commit e5f03b94b6)

Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
2025-06-24 12:02:02 +00:00
Miss Islington (bot)
961dd80e0e
[3.14] gh-135494: Fix python -m test --pgo -x test_re (GH-135713) (#135880)
gh-135494: Fix python -m test --pgo -x test_re (GH-135713)

Fix regrtest to support excluding tests from --pgo tests.
(cherry picked from commit 15c6d63fe6)

Co-authored-by: Victor Stinner <vstinner@python.org>
2025-06-24 10:48:10 +00:00
Miss Islington (bot)
85fbf80ca2
[3.14] gh-134986: Catch PermissionError when trying to call perf in tests (GH-134987) (#135841)
gh-134986: Catch PermissionError when trying to call perf in tests (GH-134987)

Using Ubuntu 24.04 on the Windows Subsystem for Linux, perf will raise a
`PermissionError` instead of `FileNotFoundError`. This commit modifies
the tests to catch that.
(cherry picked from commit 6ab842fce5)

Co-authored-by: Emma Smith <emma@emmatyping.dev>
2025-06-23 10:53:55 +00:00
Miss Islington (bot)
10f9db9b35
[3.14] gh-135815: skip netrc security checks if os.getuid is missing (GH-135816) (#135825)
gh-135815: skip `netrc` security checks if `os.getuid` is missing (GH-135816)
(cherry picked from commit b57b619e34)

Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
2025-06-22 20:12:57 +00:00
Miss Islington (bot)
2b5c904fbb
[3.14] gh-127146: Skip test_os.test_mode for Emscripten (GH-135764) (#135784)
Temporarily skip test_os.test_mode on Emscripten; this fails consistently
on the buildbot, but not on other test configurations. Reported as GH-135783
for follow up.
(cherry picked from commit f4911258a8)

Co-authored-by: Hood Chatham <roberthoodchatham@gmail.com>
2025-06-21 19:13:40 +08:00
Miss Islington (bot)
e388b29a10
[3.14] gh-135557: use atomic stores in heapq operations in free-threading (GH-135601) (#135787)
gh-135557: use atomic stores in `heapq` operations in free-threading (GH-135601)
(cherry picked from commit 13cac83347)

Co-authored-by: Xuanteng Huang <44627253+xuantengh@users.noreply.github.com>
2025-06-21 16:32:27 +05:30
Miss Islington (bot)
fa62dfe888
[3.14] gh-135645: Added supports_isolated_interpreters to sys.implementation (GH-135667) (#135786)
gh-135645: Added `supports_isolated_interpreters` to `sys.implementation` (GH-135667)
(cherry picked from commit 8ca1e4d846)

Co-authored-by: sobolevn <mail@sobolevn.me>
Co-authored-by: Eric Snow <ericsnowcurrently@gmail.com>
2025-06-21 08:21:50 +00:00
Miss Islington (bot)
35b90e8bec
[3.14] gh-135698: Fix Cross-interpreter Queue.full() With Negative/Default max_size (gh-135775)
We weren't handling non-positive maxsize values (including the default) properly
in Queue.full().  This change fixes that and adjusts an associated assert.

(cherry picked from commit c5ea8e8e8, AKA gh-135724)

Co-authored-by: Eric Snow <ericsnowcurrently@gmail.com>
2025-06-20 20:51:01 +00:00
Ken Jin
60fc42c169
[3.14] gh-135608: Add a null check for attribute promotion to fix a JIT crash (GH-135613) (#135739)
gh-135608: Add a null check for attribute promotion to fix a JIT crash (GH-135613)

Co-authored-by: devdanzin <74280297+devdanzin@users.noreply.github.com>
2025-06-20 15:24:25 +08:00
Miss Islington (bot)
203753b4bb
[3.14] gh-127146: Add skip_emscripten_stack_overflow in a few places (GH-135722) (#135733)
More tests that hit stack limits on some platforms.
(cherry picked from commit c8c13f8036)

Co-authored-by: Hood Chatham <roberthoodchatham@gmail.com>
2025-06-19 21:54:04 +00:00
Miss Islington (bot)
0370cb42da
gh-135543: Emit sys.remote_exec audit event when sys.remote_exec is called (GH-135544)
(cherry picked from commit 1ddfe59320)

Co-authored-by: Nadeshiko Manju <me@manjusaka.me>
2025-06-19 20:51:06 +00:00
Miss Islington (bot)
53b36e04d4
[3.14] gh-126112: Fix test_os.TimerfdTests: use 10 ms resolution (GH-135681) (#135704)
gh-126112: Fix test_os.TimerfdTests: use 10 ms resolution (GH-135681)

Use 10 ms for CLOCK_RES instead of 100 ms to tolerate slow buildbots.
(cherry picked from commit 5c25c884b9)

Co-authored-by: Victor Stinner <vstinner@python.org>
2025-06-19 10:06:57 +00:00
Miss Islington (bot)
bc8ed42176
[3.14] gh-133485: Use interpreters.Interpreter in InterpreterPoolExecutor (gh-135695)
Most importantly, this resolves the issues with functions and types defined in __main__.
It also expands the number of supported objects and simplifies the implementation.

(cherry picked from commit 725da50520, AKA gh-133957)

Co-authored-by: Eric Snow <ericsnowcurrently@gmail.com>
2025-06-19 00:23:12 +00:00
Miss Islington (bot)
c03f94e7fe
[3.14] gh-135450: Remove assertion in _PyCode_CheckNoExternalState (gh-135694)
The assertion reflected a misunderstanding of situations where "hidden" variables might exist,
namely generator expressions and comprehensions.

(cherry picked from commit 15f2bac02c, AKA gh-135466)

Co-authored-by: Peter Bierma <zintensitydev@gmail.com>
2025-06-18 23:57:18 +00:00
Miss Islington (bot)
3ae8a5bed3
[3.14] gh-135376: Fix and improve test_random (GH-135377) (GH-135680)
* Remove duplicated code. Tests for Random and SystemRandom now share
  the code.
* Move implementation agnostic tests that was only run for SystemRandom,
  so they are now run for Random too.
* Add tests for __index__() support.
* Add tests for randint().
(cherry picked from commit c55512311b)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2025-06-18 15:51:47 +00:00
Miss Islington (bot)
d4daf4da7e
[3.14] gh-135646: Raise consistent NameError exceptions in ForwardRef.evaluate() (GH-135663) (#135673)
gh-135646: Raise consistent `NameError` exceptions in `ForwardRef.evaluate()` (GH-135663)
(cherry picked from commit 343719d98e)

Co-authored-by: Victorien <65306057+Viicos@users.noreply.github.com>
2025-06-18 13:26:58 +00:00
Miss Islington (bot)
9ac369cb73
[3.14] gh-135335: flush stdout/stderr in forkserver after preloading modules (GH-135338) (#135670)
gh-135335: flush stdout/stderr in forkserver after preloading modules (GH-135338)

If a preloaded module writes to stdout or stderr, and the stream is buffered,
child processes will inherit the buffered data after forking. Attempt to
prevent this by flushing the streams after preload.
(cherry picked from commit 9877d191f4)

Co-authored-by: Duane Griffin <duaneg@dghda.com>
Co-authored-by: Mikhail Efimov <efimov.mikhail@gmail.com>
Co-authored-by: Victor Stinner <vstinner@python.org>
2025-06-18 12:42:18 +00:00
Miss Islington (bot)
562f6d1639
[3.14] gh-134632: Add iOS/Android test skip for C API check for headers. (GH-135656) (#135657)
iOS and Android don't ship headers in the testbed, so we can't test for their existence.
(cherry picked from commit 1c7efaf58a)

Co-authored-by: Russell Keith-Magee <russell@keith-magee.com>
2025-06-18 06:48:03 +00:00
Miss Islington (bot)
9f63a54aec
[3.14] gh-127146: Emscripten: Fix pathlib glob_dotdot test (GH-135624) (#135653)
The Emscripten path resolver uses the same mechanism for resolving `..`
at a file system root as for resolving symlinks. This is because
roots don't store their mountpoints. If the parent of a node is itself,
it is a root but it might be a mountpoint in some other file system.

If a path has enough `..`'s at the root, it will return ELOOP.
Enough turns out to be 49.
(cherry picked from commit e4ccd46bf7)

Co-authored-by: Hood Chatham <roberthoodchatham@gmail.com>
2025-06-18 04:19:43 +00:00
Miss Islington (bot)
a61bd7af6e
[3.14] gh-127146: Emscripten: Fix test failure due to missing os.link (GH-135626) (#135652)
Check for existence of os.link, rather than assuming it exists.
(cherry picked from commit ce58afb400)

Co-authored-by: Hood Chatham <roberthoodchatham@gmail.com>
2025-06-18 04:03:32 +00:00
Miss Islington (bot)
bf189d7ab5
[3.14] gh-127146: Emscripten: Skip test_url2pathname_resolve_host (GH-135634) (#135651)
Emscripten currently `gethostbyname_r()` returns an incorrect
IP address for `localhost`. Will be resolved by upstream PR:
https://github.com/emscripten-core/emscripten/pull/24593
(cherry picked from commit 2a49c54ab2)

Co-authored-by: Hood Chatham <roberthoodchatham@gmail.com>
2025-06-18 03:23:31 +00:00
Miss Islington (bot)
77e2ac14c6
[3.14] gh-127146: Allow ignored keys to be missing in test_sysconfig (GH-135622) (#135650)
Fixes the test on Emscripten where userbase can be missing.
(cherry picked from commit 28c71ee4b2)

Co-authored-by: Hood Chatham <roberthoodchatham@gmail.com>
2025-06-18 03:17:22 +00:00
Miss Islington (bot)
2c29ee835a
[3.14] gh-132775: Fix Interpreter.call() __main__ Visibility (gh-135638)
As noted in the new tests, there are a few situations we must carefully accommodate
for functions that get pickled during interp.call().  We do so by running the script
from the main interpreter's __main__ module in a hidden module in the other
interpreter.  That hidden module is used as the function __globals__.

(cherry picked from commit 269e19e0a7, AKA gh-135595)

Co-authored-by: Eric Snow <ericsnowcurrently@gmail.com>
2025-06-17 20:24:08 +00:00
Miss Islington (bot)
1bd034de9d
[3.14] gh-134632: Fix build-details.json to use INCLUDEPY path (GH-134633) (#135605)
gh-134632: Fix `build-details.json` to use `INCLUDEPY` path (GH-134633)

* gh-134632: Fix `build-details.json` to use `INCLUDEPY` path

Fix ``build-details.json`` generation to use ``INCLUDEPY``, in order to
reference the ``pythonX.Y`` subdirectory of the include directory, as
required in :pep:`739`, instead of the top-level include directory.

* test_build_details: Add tests for the c_api section

* test_build_details: Expect pkgconfig for CPython unconditionally
(cherry picked from commit 0d582def34)

Co-authored-by: Michał Górny <mgorny@gentoo.org>
2025-06-17 08:31:10 +00:00
Miss Islington (bot)
d2292c29f7
[3.14] gh-135489: Show verbose output for failing tests during PGO profiling step with --enable-optimizations (#135599)
(cherry picked from commit 5b3a826888)

Co-authored-by: PuQing <me@puqing.work>
2025-06-17 01:37:39 -04:00
Miss Islington (bot)
2b1c0a76dc
[3.14] gh-135443: Sometimes Fall Back to __main__.__dict__ For Globals (gh-135593)
For several builtin functions, we now fall back to __main__.__dict__ for the globals
when there is no current frame and _PyInterpreterState_IsRunningMain() returns
true.  This allows those functions to be run with Interpreter.call().

The affected builtins:

* exec()
* eval()
* globals()
* locals()
* vars()
* dir()

We take a similar approach with "stateless" functions, which don't use any
global variables.

(cherry picked from commit a450a0ddec, AKA gh-135491)

Co-authored-by: Eric Snow <ericsnowcurrently@gmail.com>
2025-06-16 23:59:30 +00:00
Miss Islington (bot)
964c29d281
[3.14] gh-116738: Make _heapq module thread-safe (GH-135036) (gh-135309)
Use critical sections to make heapq methods that update the heap thread-safe when the GIL is disabled.
(cherry picked from commit a58026a5e3)

Co-authored-by: Alper <alperyoney@fb.com>
Co-authored-by: mpage <mpage@meta.com>
2025-06-16 13:27:43 -04:00
Miss Islington (bot)
15f7bd4295
[3.14] gh-132617: Fix dict.update() mutation check (gh-134815) (gh-135581)
Use `ma_used` instead of `ma_keys->dk_nentries` for modification check
so that we only check if the dictionary is modified, not if new keys are
added to a different dictionary that shared the same keys object.
(cherry picked from commit d8994b0a77)

Co-authored-by: Sam Gross <colesbury@gmail.com>
2025-06-16 17:19:58 +00:00
Mikhail Efimov
2ef78a85e4
[3.14] GH-135171: Revert async generator expressions behavior (#135352) 2025-06-16 17:45:42 +03:00
Miss Islington (bot)
43bf8b30f9
[3.14] gh-127319: Disable port reuse on HTTP, XMLRPC, and logging TCP servers (GH-135405) (GH-135538)
(cherry picked from commit 2bd3895fca)
2025-06-16 08:05:26 +01:00
Miss Islington (bot)
1c4f01a160
[3.14] gh-67022: Document bytes/str inconsistency in email.header.decode_header() and suggest email.headerregistry.HeaderRegistry as a sane alternative (GH-92900) (#135548)
gh-67022: Document bytes/str inconsistency in email.header.decode_header() and suggest email.headerregistry.HeaderRegistry as a sane alternative (GH-92900)

* gh-67022: Document bytes/str inconsistency in email.header.decode_header()

This function's possible return types have been surprising and error-prone
for the entirety of its Python 3.x history. It can return either:

1. `typing.List[typing.Tuple[bytes, typing.Optional[str]]]` of length >1
2. or `typing.List[typing.Tuple[str, None]]`, of length exactly 1

This means that any user of this function must be prepared to accept either
`bytes` or `str` for the first member of the 2-tuples it returns, which is a
very surprising behavior in Python 3.x, particularly given that the second
member of the tuple is supposed to represent the charset/encoding of the
first member.

This patch documents the behavior of this function, and adds test cases
to demonstrate it.

As discussed in bpo-22833, this cannot be changed in a backwards-compatible
way, and some users of this function depend precisely on the existing
behavior.

Add warnings about obsolescence of 'email.header.decode_header' and 'email.header.make_header' functions.

Recommend use of `email.headerregistry.HeaderRegistry` instead, as suggested
in https://github.com/python/cpython/pull/92900#discussion_r1112472177
(cherry picked from commit 60181f4ed0)

Co-authored-by: Dan Lenski <dlenski@gmail.com>
2025-06-15 16:02:16 -04:00
Miss Islington (bot)
f8f99b1cfc
[3.14] gh-135371: Fix asyncio introspection output to include internal coroutine chains (GH-135436) (#135509)
gh-135371: Fix asyncio introspection output to include internal coroutine chains (GH-135436)
(cherry picked from commit 028309fb47)

Co-authored-by: Pablo Galindo Salgado <Pablogsal@gmail.com>
2025-06-15 18:38:56 +00:00
Miss Islington (bot)
79df5d1c54
[3.14] gh-135368: Fix mocks on dataclass specs with instance=True (GH-135421) (#135503)
gh-135368: Fix mocks on dataclass specs with `instance=True` (GH-135421)

* gh-135368: Fix mocks on dataclass specs with `instance=True`

* Extend dataclass mock_methods

---------
(cherry picked from commit c8319a3fea)

Co-authored-by: sobolevn <mail@sobolevn.me>
Co-authored-by: Marc Mueller <30130371+cdce8p@users.noreply.github.com>
2025-06-14 09:11:31 +00:00