Commit graph

53746 commits

Author SHA1 Message Date
Miss Islington (bot)
2a6617de48
[3.13] gh-130664: support '_' (just as ',') in Decimal's formatting (GH-132155) (#136649)
gh-130664: support '_' (just as ',') in Decimal's formatting (GH-132155)
(cherry picked from commit e10fe81cc6)

Co-authored-by: Sergey B Kirpichev <skirpichev@gmail.com>
2025-07-14 14:01:49 +02:00
Duane Griffin
2383c6015c
[3.13] gh-127971: fix off-by-one read beyond the end of a string during search (#132574) (#136648)
(cherry picked from commit 85ec3b3b50)
2025-07-14 11:50:22 +02:00
Miss Islington (bot)
c4386499f6
[3.13] gh-136523: Fix wave.Wave_write emitting an unraisable when open raises (GH-136529) (GH-136607)
(cherry picked from commit 171de05b48)

Co-authored-by: Sachin Shah <39803835+inventshah@users.noreply.github.com>
2025-07-13 06:13:01 +00:00
Miss Islington (bot)
d733a1ed77
[3.13] gh-136549: Fix signature of threading.excepthook() (GH-136559) (GH-136590)
(cherry picked from commit be2c3d284e)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2025-07-12 16:16:19 +00:00
Bénédikt Tran
360540fd47
[3.13] gh-91153: prevent a crash in bytearray.__setitem__(ind, ...) when ind.__index__ has side-effects (GH-132379) (#136582)
(cherry picked from commit 5e1e21dee3)

Co-authored-by: Bast <52266665+bast0006@users.noreply.github.com>
2025-07-12 16:34:45 +02:00
Miss Islington (bot)
6176101b4a
[3.13] gh-134759: fix UnboundLocalError in email.message.Message.get_payload (GH-136071) (#136580)
gh-134759: fix `UnboundLocalError` in `email.message.Message.get_payload` (GH-136071)
(cherry picked from commit 25335d297b)

Co-authored-by: Kliment Lamonov <klimentlamonov@yandex.ru>
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
2025-07-12 13:52:54 +00:00
Miss Islington (bot)
aa3c6421ef
[3.13] gh-52876: Implement missing parameter in codecs.StreamReaderWriter functions (GH-136498) (#136515)
gh-52876: Implement missing parameter in `codecs.StreamReaderWriter` functions (GH-136498)

Closes GH-52876
(cherry picked from commit 35e2c35970)

Co-authored-by: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com>
2025-07-10 18:06:34 +02:00
sobolevn
a2140fad71
[3.13] gh-136438: Make sure test_builtins pass with all optimization levels (GH-136474) (#136502)
(cherry picked from commit c176543349)
2025-07-10 11:17:20 +00:00
Miss Islington (bot)
532ecac771
[3.13] gh-136447: Use self.loop instead of global loop variable in asyncio REPL (GH-136448) (#136457)
gh-136447: Use `self.loop` instead of global `loop` variable in asyncio REPL (GH-136448)
(cherry picked from commit 77fa7a4dcc)

Co-authored-by: Justin Su <injustsu@gmail.com>
2025-07-09 09:21:47 +00:00
Miss Islington (bot)
4a889d8436
[3.13] gh-136297: Fix hypothesis and subTest usage in test_zoneinfo_property.py (GH-136384) (#136408)
gh-136297: Fix `hypothesis` and `subTest` usage in `test_zoneinfo_property.py` (GH-136384)
(cherry picked from commit db699db99d)

Co-authored-by: sobolevn <mail@sobolevn.me>
2025-07-08 08:14:14 +00:00
Miss Islington (bot)
eea2af3dd8
[3.13] gh-124486: Fix test_whichdb_ndbm in test_dbm on NetBSD (GH-136335) (GH-136379)
On NetBSD, ndbm.open() does not fail for empty file.
(cherry picked from commit b7aa2a4b4d)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2025-07-07 12:50:40 +00:00
Miss Islington (bot)
4f24dc0ea8
[3.13] gh-136289: Fix test_sqlite3 on platforms with strict UTF-8 filesystem (GH-136326) (GH-136351)
(cherry picked from commit 85b817da94)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2025-07-07 12:43:22 +03:00
Miss Islington (bot)
b22c8be18a
[3.13] gh-136297: Test all pickle protocols in test_zoneinfo_property.py (GH-136298) (#136312)
gh-136297: Test all `pickle` protocols in `test_zoneinfo_property.py` (GH-136298)
(cherry picked from commit 5de7e3f973)

Co-authored-by: sobolevn <mail@sobolevn.me>
2025-07-05 06:36:41 +00:00
Miss Islington (bot)
7038e4a243
[3.13] gh-102555: Fix comment parsing in HTMLParser according to the HTML5 standard (GH-135664) (GH-136272)
* "--!>" now ends the comment.
* "-- >" no longer ends the comment.
* Support abnormally ended empty comments "<-->" and "<--->".

---------
(cherry picked from commit 8ac7613dc8)

Co-author: Kerim Kabirov <the.privat33r+gh@pm.me>
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
Co-authored-by: Ezio Melotti <ezio.melotti@gmail.com>
2025-07-04 07:22:33 +00:00
Miss Islington (bot)
b041a456f1
[3.13] gh-135661: Fix parsing start and end tags in HTMLParser according to the HTML5 standard (GH-135930) (GH-136256)
* Whitespaces no longer accepted between `</` and the tag name.
  E.g. `</ script>` does not end the script section.

* Vertical tabulation (`\v`) and non-ASCII whitespaces no longer recognized
  as whitespaces. The only whitespaces are `\t\n\r\f `.

* Null character (U+0000) no longer ends the tag name.

* Attributes and slashes after the tag name in end tags are now ignored,
  instead of terminating after the first `>` in quoted attribute value.
  E.g. `</script/foo=">"/>`.

* Multiple slashes and whitespaces between the last attribute and closing `>`
  are now ignored in both start and end tags. E.g. `<a foo=bar/ //>`.

* Multiple `=` between attribute name and value are no longer collapsed.
  E.g. `<a foo==bar>` produces attribute "foo" with value "=bar".

* Whitespaces between the `=` separator and attribute name or value are no
  longer ignored. E.g. `<a foo =bar>` produces two attributes "foo" and
  "=bar", both with value None; `<a foo= bar>` produces two attributes:
  "foo" with value "" and "bar" with value None.

---------
(cherry picked from commit 0243f97cba)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
Co-authored-by: Ezio Melotti <ezio.melotti@gmail.com>
2025-07-03 21:07:40 +00:00
Miss Islington (bot)
c30178a295
[3.13] gh-130664: Treat '0' fill character with align '=' as zero-padding for Fraction's (GH-131067) (GH-136242)
(cherry picked from commit c113a8e523)

Co-authored-by: Sergey B Kirpichev <skirpichev@gmail.com>
2025-07-03 11:20:49 +00:00
Miss Islington (bot)
fc77192109
[3.13] gh-135069: Fix exception message in encodings.idna module (GH-135071) (#136236)
gh-135069: Fix exception message in encodings.idna module (GH-135071)
(cherry picked from commit 8dc3383abe)

Co-authored-by: Daniel Hollas <daniel.hollas@bristol.ac.uk>
2025-07-03 10:31:43 +00:00
Miss Islington (bot)
a09199e3cc
[3.13] Docs: fix docstring of email.message.Message.add_header (GH-134355) (#135340)
Docs: fix docstring of `email.message.Message.add_header` (GH-134355)
(cherry picked from commit c23eec2960)

Co-authored-by: Alexander Shadchin <shadchin@yandex-team.com>
Co-authored-by: Kumar Aditya <kumaraditya@python.org>
2025-07-03 10:22:39 +00:00
Miss Islington (bot)
1de8fc3e4b
[3.13] gh-135640: Adds more type checking to ElementTree (GH-135643) (GH-136226)
(cherry picked from commit e0245c789f)

Co-authored-by: Kira <kirawhoprograms@fastmail.com>
2025-07-03 08:12:21 +00:00
Miss Islington (bot)
d80df8c1a5
[3.13] gh-135836: Fix IndexError in asyncio.create_connection() (GH-135875) (#136222)
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:31:43 +00:00
Miss Islington (bot)
1994d2e5b1
[3.13] gh-135836: Fix IndexError in asyncio.create_connection with empty exceptions list (GH-135845) (#136168)
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:28 +05:30
Miss Islington (bot)
da2c4ef7eb
[3.13] gh-87298: Add tests for find_in_strong_cache() bug in _zoneinfo (GH-24829) (GH-136182)
(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:19:39 +00:00
Miss Islington (bot)
1e3466a1ae
[3.13] gh-133982: Use implementation-specific open in test_fileio.OtherFileTests (GH-135364) (GH-136149)
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:19:14 +00:00
Miss Islington (bot)
e194793602
[3.13] gh-85702: Catch PermissionError in zoneinfo.load_tzdata() (GH-136117) (#136136)
gh-85702: Catch PermissionError in zoneinfo.load_tzdata() (GH-136117)
(cherry picked from commit ee47670e8b)

Co-authored-by: Victor Stinner <vstinner@python.org>
Co-authored-by: Peter Bierma <zintensitydev@gmail.com>
2025-06-30 16:31:45 +00:00
Miss Islington (bot)
4f4fa72695
[3.13] gh-85702: Catch IsADirectoryError in zoneinfo (GH-131333) (#136130)
gh-85702: Catch IsADirectoryError in zoneinfo (GH-131333)
(cherry picked from commit d22604a6d1)

Co-authored-by: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com>
Co-authored-by: Victor Stinner <vstinner@python.org>
2025-06-30 15:00:56 +00:00
Victor Stinner
b5fafc3ab9
[3.13] gh-128051: Fix tests if sys.float_repr_style is 'legacy' (#135908) (#136026)
gh-128051: Fix tests if sys.float_repr_style is 'legacy' (#135908)


(cherry picked from commit f3aec60d7a)

Co-authored-by: Sergey B Kirpichev <skirpichev@gmail.com>
2025-06-30 11:40:06 +02:00
Miss Islington (bot)
be9a38366b
[3.13] gh-136087: Remove \r from documented os.linesep values (GH-136088) (#136112)
gh-136087: Remove `\r` from documented `os.linesep` values (GH-136088)
(cherry picked from commit 980a56843b)

Co-authored-by: sobolevn <mail@sobolevn.me>
2025-06-30 10:44:38 +03:00
Miss Islington (bot)
76dd0eee05
[3.13] Doc: Fix duplicate words in idlelib (GH-136089) (#136091)
Doc: Fix duplicate words in idlelib (GH-136089)
(cherry picked from commit f04d2b8819)

Co-authored-by: Weilin Du <108666168+LamentXU123@users.noreply.github.com>
2025-06-29 07:09:36 +00:00
Bénédikt Tran
d3bcecdcdb
[3.13] gh-135571: Guard _hashlib usage in test_hashlib.py (GH-135572) (#136041)
(cherry picked from commit 065194c1a9)

Co-authored-by: Will Childs-Klein <willck93@gmail.com>
2025-06-28 10:15:49 +02:00
Miss Islington (bot)
e7a8f9664a
[3.13] gh-136028: Fix parsing month names containing "İ" (U+0130) in strptime() (GH-136029) (GH-136038)
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:10:51 +00:00
Serhiy Storchaka
3576e1a954
[3.13] gh-78465: Fix error message for cls.__new__(cls, ...) where cls is not instantiable (GH-135981) (GH-136031)
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)
2025-06-27 12:07:22 +00:00
Miss Islington (bot)
ea25f4a8ec
[3.13] gh-53203: Fix strptime() for %c, %x and %X formats on some locales (GH-135971) (GH-136020)
* 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:12:58 +00:00
Miss Islington (bot)
784c0eda7e
[3.13] gh-135995: Fix missing char in palmos encoding (GH-135990) (#136002)
gh-135995: Fix missing char in palmos encoding (GH-135990)

0x8b correctly encodes to ‹, but 0x9b was mistakenly marked as a control character instead of ›.
---------
(cherry picked from commit 58a42dea97)

Co-authored-by: Nathan Korth <nkorth@users.noreply.github.com>
Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
Co-authored-by: Brian Schubert <brianm.schubert@gmail.com>
Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
2025-06-26 22:59:24 +00:00
Miss Islington (bot)
ac8b868f3c
[3.13] IDLE: Update NEWS2x.txt with 2.7.0 release date (GH-129908) (#136000)
IDLE: Update NEWS2x.txt with 2.7.0 release date (GH-129908)
(cherry picked from commit 642e5dfc74)

Co-authored-by: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com>
2025-06-26 20:42:29 +00:00
Miss Islington (bot)
21f9873385
[3.13] gh-135956: Remove duplicate word in _pydatetime docstring (GH-135957) (#135963)
gh-135956: Remove duplicate word in _pydatetime docstring (GH-135957)

_pydatetime.isoformat docstring repeats 'giving'.
(cherry picked from commit e3ea6f2b3b)

Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
2025-06-26 04:08:17 +00:00
Miss Islington (bot)
c148a68efe
[3.13] gh-91555: Revert disabling of logger while handling log record. (GH-135858) (GH-135911)
Co-authored-by: Vinay Sajip <vinay_sajip@yahoo.co.uk>
2025-06-25 19:24:55 +01:00
Brian Schubert
3e4362812e
[3.13] gh-135855: Raise TypeError When Passing Non-dict Object to _interpreters.set___main___attrs (gh-135903)
(cherry picked from commit 4e6f0d116e, AKA gh-135856)
2025-06-24 16:23:26 -06:00
Miss Islington (bot)
86d1821ef1
[3.13] gh-135487: fix reprlib.Repr.repr_int when given very large integers (GH-135506) (#135886)
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:00:14 +00:00
Victor Stinner
a27398d5b3
[3.13] gh-135494: Fix python -m test --pgo -x test_re (#135713) (#135881)
gh-135494: Fix python -m test --pgo -x test_re (#135713)

Fix regrtest to support excluding tests from --pgo tests.

(cherry picked from commit 15c6d63fe6)
2025-06-24 10:49:31 +00:00
Hugo van Kemenade
028d56fd78
[3.13] Bump mypy to 1.16.1 (GH-135720) (#135849)
Co-authored-by: sobolevn <mail@sobolevn.me>
2025-06-24 10:20:55 +03:00
Eric Snow
666795ae34
[3.13] gh-135698: Fix Cross-interpreter Queue.full() With Negative/Default max_size (gh-135778)
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 c5ea8e8, AKA gh-135724)
2025-06-23 19:38:41 +00:00
Miss Islington (bot)
3e81d56a1b
[3.13] gh-134986: Catch PermissionError when trying to call perf in tests (GH-134987) (#135842)
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:51:51 +00:00
Miss Islington (bot)
6e0ad71a29
[3.13] gh-135815: skip netrc security checks if os.getuid is missing (GH-135816) (#135826)
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:20 +00:00
Miss Islington (bot)
a8c3af080a
[3.13] gh-135273: Unify ZoneInfo.from_file signatures (GH-135274) (#135715)
gh-135273: Unify `ZoneInfo.from_file` signatures (GH-135274)

Align `ZoneInfo.from_file` pure-Python signature with Argument Clinic signature.
(cherry picked from commit 7cc8949692)

Co-authored-by: Andrii Hrimov <andrew.hrimov@gmail.com>
2025-06-19 15:10:54 +00:00
Miss Islington (bot)
55a34a1d16
[3.13] gh-126112: Fix test_os.TimerfdTests: use 10 ms resolution (GH-135681) (#135705)
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:04:48 +00:00
Miss Islington (bot)
a0a1aa3125
[3.13] gh-135335: flush stdout/stderr in forkserver after preloading modules (GH-135338) (#135671)
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:40:21 +00:00
Miss Islington (bot)
28a70a59e4
[3.13] gh-135489: Show verbose output for failing tests during PGO profiling step with --enable-optimizations (#135600)
Co-authored-by: PuQing <me@puqing.work>
2025-06-17 01:47:27 -04:00
Sam Gross
f33a5e891a
[3.13] gh-132617: Fix dict.update() mutation check (gh-134815) (gh-135582)
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)
2025-06-16 17:30:52 +00:00
Miss Islington (bot)
404e8aa9f3
[3.13] gh-132969: Fix error/hang when shutdown(wait=False) and task exited abnormally (GH-133222) (GH-135343)
gh-132969:  Fix error/hang when shutdown(wait=False) and task exited abnormally (GH-133222)

When shutdown is called with wait=False, the executor thread keeps running
even after the ProcessPoolExecutor's state is reset. The executor then tries
to replenish the worker processes pool resulting in an error and a potential hang
when it comes across a worker that has died. Fixed the issue by having
_adjust_process_count() return without doing anything if the ProcessPoolExecutor's
state has been reset.

Added unit tests to validate two scenarios:
max_workers < num_tasks (exception)
max_workers > num_tasks (exception + hang)
(cherry picked from commit 598aa7cc98)

Co-authored-by: Ajay Kamdar <140011370+ogbiggles@users.noreply.github.com>
2025-06-16 14:08:03 +02:00
Miss Islington (bot)
3bd2818664
[3.13] gh-67022: Document bytes/str inconsistency in email.header.decode_header() and suggest email.headerregistry.HeaderRegistry as a sane alternative (GH-92900) (#135549)
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:43 -04:00