Commit graph

32590 commits

Author SHA1 Message Date
Noam Cohen
aebbbaffe8
[3.13] gh-132542: Set native thread ID after fork (GH-132701) (GH-134361)
(cherry picked from commit 6b73502313)
2025-05-20 17:03:19 +00:00
Serhiy Storchaka
6279eb8c07
[3.13] gh-133767: Fix use-after-free in the unicode-escape decoder with an error handler (GH-129648) (GH-133944)
If the error handler is used, a new bytes object is created to set as
the object attribute of UnicodeDecodeError, and that bytes object then
replaces the original data. A pointer to the decoded data will became invalid
after destroying that temporary bytes object. So we need other way to return
the first invalid escape from _PyUnicode_DecodeUnicodeEscapeInternal().

_PyBytes_DecodeEscape() does not have such issue, because it does not
use the error handlers registry, but it should be changed for compatibility
with _PyUnicode_DecodeUnicodeEscapeInternal().
(cherry picked from commit 9f69a58623)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2025-05-20 14:46:57 +02:00
Miss Islington (bot)
edf2de0178
[3.13] Clean up test_posixpath (GH-134315) (GH-134317)
* Ensure that created files and dirs are always removed after test.
  Now addCleanup() does not conflict with tearDown().
* Use os_helper.unlink() and os_helper.rmdir().
* Import TESTFN from os_helper.
(cherry picked from commit e29171bf8a)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2025-05-20 08:15:29 +00:00
Miss Islington (bot)
783675e73f
[3.13] gh-133940: test_strftime incorrectly calculates expected week (GH-134281) (#134302)
gh-133940: test_strftime incorrectly calculates expected week (GH-134281)

Let the system determine the correct tm_wday and tm_isdst.
(cherry picked from commit e3dda8f818)

Co-authored-by: Gustaf <79180496+GGyll@users.noreply.github.com>
2025-05-20 01:17:22 +00:00
Miss Islington (bot)
da506b2560
[3.13] gh-117596: Add more tests for os.path with invalid paths (GH-134189) (GH-134266)
(cherry picked from commit 871d269875)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2025-05-19 18:41:37 +00:00
Miss Islington (bot)
08c9ba5b72
[3.13] gh-134097: Print number of refs & blocks after each statement in new REPL (gh-134136) (gh-134221)
(cherry picked from commit c31547a591)

Co-authored-by: Kirill Podoprigora <kirill.bast9@mail.ru>
Co-authored-by: Łukasz Langa <lukasz@langa.pl>
2025-05-19 16:13:25 +02:00
Serhiy Storchaka
06a8c0613e
[3.13] gh-133890: Handle UnicodeEncodeError in tarfile (GH-134147) (GH-134196)
UnicodeEncodeError is now handled the same way as OSError during
TarFile member extraction.
(cherry picked from commit 9983c7d441)
2025-05-19 10:37:36 +00:00
Miss Islington (bot)
821a87e7a6
[3.13] gh-133889: Only show the path of the URL in the SimpleHTTPRequestHandler page (GH-134135) (GH-134191)
The query and fragment are ambiguous and not used.
(cherry picked from commit 5cbc8c632e)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2025-05-18 22:16:56 +03:00
Miss Islington (bot)
523024499e
[3.13] gh-134100: Fix use-after-free in PyImport_ImportModuleLevelObject (GH-134117) (#134172)
gh-134100: Fix use-after-free in `PyImport_ImportModuleLevelObject` (GH-134117)
(cherry picked from commit 4e9005d32f)

Co-authored-by: Nico-Posada <102486290+Nico-Posada@users.noreply.github.com>
2025-05-18 20:38:28 +05:30
Thomas Grainger
fd6a602d04
[3.13] gh-133745: Fix asyncio task factory name/context kwarg breaks (#133948)
In 3.13.3 we accidentally broke the interface for custom task factory. Factory authors added workarounds.
This PR (for 3.13.4) unbreaks task factories that haven't made a workaround yet while also supporting those that have.

NOTE: The custom task factory API will change to what we accidentally released in 3.13.3.

Co-authored-by: Kumar Aditya <kumaraditya@python.org>
Co-authored-by: Guido van Rossum <gvanrossum@gmail.com>
2025-05-18 06:50:07 -07:00
Miss Islington (bot)
bc0dc9d4ef
[3.13] gh-134098: Fix handling %-encoded trailing slash in SimpleHTTPRequestHandler (GH-134099) (GH-134124)
(cherry picked from commit 2f1ecb3bc4)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2025-05-17 07:33:42 +00:00
Miss Islington (bot)
6dae082584
[3.13] gh-133889: Improve tests for SimpleHTTPRequestHandler (GH-134102) (GH-134122)
(cherry picked from commit fcaf009907)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2025-05-17 07:23:27 +00:00
Miss Islington (bot)
f81f1bb2f9
[3.13] Test also error messages in test_limit_int. (GH-134018) (GH-134032)
(cherry picked from commit e123a1d09b)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2025-05-15 07:45:00 +00:00
Miss Islington (bot)
f474264b1e
[3.13] Improve tests for str to Fraction conversion (GH-134010) (GH-134017)
(cherry picked from commit 17d0fec702)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2025-05-14 17:42:23 +00:00
Sam Gross
e1cc789531
gh-132869: Fix crash in _PyObject_TryGetInstanceAttribute (#133700)
This fixes a crash in `_PyObject_TryGetInstanceAttribute` due to the use
of `_PyDictKeys_StringLookup` on an unlocked dictionary that may be
concurrently modified.

The underlying bug was already fixed in 3.14 and the main branch.

(partially cherry picked from commit 1b15c89a17)
2025-05-14 12:47:34 +09:00
Brandt Bucher
50b45c4f45
[3.13] GH-133543: Maintain tracking for materialized instance dictionaries (GH-133617) 2025-05-12 13:00:01 -07:00
Serhiy Storchaka
d9d8e9a00c
[3.13] gh-133677: Fix tests when running in non-UTF-8 locale (GH-133865) (GH-133939)
(cherry picked from commit 14305a83d3)
2025-05-12 17:02:19 +00:00
Victor Stinner
5ce47b96b0
[3.13] gh-133744: Fix multiprocessing interrupt test: add an event (#133746) (#133917)
gh-133744: Fix multiprocessing interrupt test: add an event (#133746)

Add an event to synchronize the parent process with the child
process: wait until the child process starts sleeping.

(cherry picked from commit c2989b7070)
2025-05-12 14:16:52 +00:00
Miss Islington (bot)
8e923f3659
[3.13] gh-91555: disable logger while handling log record (GH-131812) (GH-133898)
Co-authored-by: Duane Griffin <duaneg@dghda.com>
2025-05-12 07:29:06 +01:00
Victor Stinner
5cd56b249f
[3.13] gh-133441: Fix STORE_ATTR_WITH_HINT bytecode (#133446)
Deoptimize if the dict is a dict subclass.

Co-authored-by: Peter Bierma <zintensitydev@gmail.com>
2025-05-11 23:10:04 +02:00
Inada Naoki
f0a88e2ce5
gh-133703: dict: fix calculate_log2_keysize() (GH-133809)
(cherry picked from commit 92337f666e)
2025-05-11 15:14:11 +09:00
Miss Islington (bot)
26b6ab49e4
[3.13] Add classmethod to setUpClass in test_pdb (GH-133840) (#133847)
Add classmethod to setUpClass in test_pdb (GH-133840)
(cherry picked from commit 4f2f780d53)

Co-authored-by: Tian Gao <gaogaotiantian@hotmail.com>
2025-05-10 18:34:32 +00:00
Miss Islington (bot)
e76ff560b0
[3.13] gh-86155: Fix data loss after unclosed script or style tag in HTMLParser (GH-22658) (GH-133845)
When calling .close() the HTMLParser should flush all remaining content,
even when that content is in an unclosed script or style tag.
(cherry picked from commit 53383e90e4)

Co-authored-by: Waylan Limberg <waylan.limberg@icloud.com>
2025-05-10 17:58:29 +00:00
Miss Islington (bot)
18501a11e0
[3.13] gh-132642: document how to render human-readable timedelta objects (GH-133825) (#133836)
gh-132642: document how to render human-readable `timedelta` objects (GH-133825)
(cherry picked from commit efcc42ba70)

Co-authored-by: Kentaro Jay Takahashi <64148935+KentaroJay@users.noreply.github.com>
2025-05-10 15:57:29 +00:00
Miss Islington (bot)
aa0c3d1098
[3.13] gh-77057: Fix handling of invalid markup declarations in HTMLParser (GH-9295) (GH-133834)
(cherry picked from commit 76c0b01bc4)

Co-authored-by: Ezio Melotti <ezio.melotti@gmail.com>
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2025-05-10 14:55:12 +00:00
Miss Islington (bot)
9718880ba9
[3.13] gh-133009: fix UAF in xml.etree.ElementTree.Element.__deepcopy__ (GH-133010) (#133806)
gh-133009: fix UAF in `xml.etree.ElementTree.Element.__deepcopy__` (GH-133010)
(cherry picked from commit 116a9f9b37)

Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
2025-05-10 07:55:47 +00:00
Miss Islington (bot)
ddd6ca193f
[3.13] gh-133519: Add console to resources in libregrtest (GH-133520) (#133777)
gh-133519: Add console to resources in libregrtest (GH-133520)

Add console to resources in libregrtest
(cherry picked from commit 4274b47156)

Co-authored-by: AN Long <aisk@users.noreply.github.com>
2025-05-09 16:53:19 +00:00
Miss Islington (bot)
d14a1b7a0d
[3.13] gh-130197: Test pygettext --output option (GH-133041) (GH-133266)
(cherry picked from commit e5e51bd7f7)

Co-authored-by: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com>
2025-05-09 07:56:58 +00:00
Miss Islington (bot)
3e55441090
[3.13] gh-69426: HTMLParser: only unescape properly terminated character entities in attribute values (GH-95215) (GH-133586)
According to the HTML5 spec, named character references in attribute values
should only be processed if they are not followed by an ASCII alphanumeric,
or an equals sign.
(cherry picked from commit 77b14a6d58)


https: //html.spec.whatwg.org/multipage/parsing.html#named-character-reference-state

Co-authored-by: Sascha Ißbrücker <sascha.issbruecker@googlemail.com>
2025-05-09 09:43:54 +03:00
Sam Gross
6ab4a4a32c
[3.13] gh-132762: Fix underallocation bug in dict.fromkeys()(gh-133627) (gh-133686)
The function `dict_set_fromkeys()` adds elements of a set to an existing
dictionary. The size of the expanded dictionary was estimated with
`PySet_GET_SIZE(iterable)`, which did not take into account the size of the
existing dictionary.
(cherry picked from commit 421ba589d0)

Co-authored-by: Angela Liss <59097311+angela-tarantula@users.noreply.github.com>
2025-05-08 17:40:05 +00:00
Serhiy Storchaka
8e334f40b8
[3.13] gh-131031: Fix test_pickle when invoked directly (GH-133356) (GH-133675)
(cherry picked from commit e15bbfafbc)
2025-05-08 15:23:54 +00:00
Miss Islington (bot)
fabe89b078
[3.13] gh-133454: Mark tests with many threads that use much memory as bigmem (GH-133456) (GH-133664)
(cherry picked from commit 26839eae20)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2025-05-08 13:20:34 +00:00
TERESH1
a719e5fbb6
[3.13] gh-133516: Raise ValueError when constants True, False or None are used as an identifier after NFKC normalization (GH-133523) (#133615) 2025-05-08 12:18:26 +01:00
Miss Islington (bot)
a0dd4f0c56
[3.13] gh-133639: Fix test_auto_indent_default() doesn't run input_code (GH-133640) (#133647) 2025-05-08 08:47:38 +00:00
Łukasz Langa
891232f338
[3.13] gh-131878: Fix input of unicode characters with two or more code points in new pyrepl on Windows (gh-131901) (gh-133468)
(cherry picked from commit 0c5151bc81)

Co-authored-by: Sergey Miryanov <sergey.miryanov@gmail.com>
Co-authored-by: Tomas R. <tomas.roun8@gmail.com>
Co-authored-by: Chris Eibl <138194463+chris-eibl@users.noreply.github.com>
2025-05-05 23:08:09 +02:00
Łukasz Langa
76f52c434c
[3.13] gh-130804: Fix support of typing unicode chars in pyrepl (GH-130805) (GH-133462)
(cherry picked from commit 7c98b0674d)

Co-authored-by: Sergey Miryanov <sergey.miryanov@gmail.com>
2025-05-05 21:39:21 +02:00
Łukasz Langa
e4d68488bc
[3.13] GH-132439: Fix REPL swallowing characters entered with AltGr on cmd.exe (GH-132440) (GH-133460)
(cherry picked from commit 07f416a3f0)

Co-authored-by: Chris Eibl <138194463+chris-eibl@users.noreply.github.com>
Co-authored-by: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com>
2025-05-05 20:09:34 +02:00
Miss Islington (bot)
a2bf7a0a47
[3.13] gh-124096: Enable REPL virtual terminal support on Windows (GH-124119) (GH-133457)
To support virtual terminal mode in Windows PYREPL, we need a scanner
to read over the supported escaped VT sequences.

Windows REPL input was using virtual key mode, which does not support
terminal escape sequences. This patch calls `SetConsoleMode` properly
when initializing and send sequences to enable bracketed-paste modes
to support verbatim copy-and-paste.
(cherry picked from commit a65366ed87)

Co-authored-by: Y5 <124019959+y5c4l3@users.noreply.github.com>
Signed-off-by: y5c4l3 <y5c4l3@proton.me>
Co-authored-by: Petr Viktorin <encukou@gmail.com>
Co-authored-by: Pablo Galindo Salgado <Pablogsal@gmail.com>
Co-authored-by: Dustin L. Howett <dustin@howett.net>
Co-authored-by: wheeheee <104880306+wheeheee@users.noreply.github.com>
2025-05-05 19:39:06 +02:00
Miss Islington (bot)
d84a762a64
[3.13] gh-63882: Break down and tests in test_minidom (GH-133026) (#133451)
Co-authored-by: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com>
2025-05-05 19:31:53 +03:00
Miss Islington (bot)
df1669ed20
[3.13] Bump mypy to 1.15 (GH-133405) (#133429)
Bump mypy to 1.15 (GH-133405)
(cherry picked from commit 8467026ed6)

Co-authored-by: sobolevn <mail@sobolevn.me>
2025-05-05 10:54:56 +00:00
Miss Islington (bot)
e89ca3991c
[3.13] [tests] test_subprocess maybe avoid a timeout race condition? (GH-133420) (#133421)
[tests] test_subprocess maybe avoid a timeout race condition? (GH-133420)

The few buildbot failures on https://github.com/python/cpython/pull/133103
are possibly just due to racing a child process launch and exit?
(cherry picked from commit b64aa302d7)

Co-authored-by: Gregory P. Smith <greg@krypto.org>
2025-05-05 04:25:41 +00:00
Miss Islington (bot)
3d1b8e2a96
[3.13] gh-133089: Use original timeout value for TimeoutExpired when the func subprocess.run is called with a timeout (GH-133103) (#133418)
gh-133089: Use original timeout value for `TimeoutExpired` when the func `subprocess.run` is called with a timeout (GH-133103)
(cherry picked from commit 2bbcaedb75)

Signed-off-by: Manjusaka <me@manjusaka.me>
Co-authored-by: Nadeshiko Manju <me@manjusaka.me>
Co-authored-by: Gregory P. Smith <greg@krypto.org>
2025-05-05 01:38:30 +00:00
Miss Islington (bot)
5daeebbbf2
[3.13] gh-109700: Improve stress tests for interpreter creation (GH-109946) (GH-133391)
* Ensure that destructors are called in the test that created interpreters, not after finishing it.
* Try to create/run interpreters in threads simultaneously.
* Mark tests that requires over 6GB of memory with bigmemtest.
(cherry picked from commit 61b50a98b4)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2025-05-04 19:18:49 +00:00
Serhiy Storchaka
973e2d3e29
[3.13] gh-122559: Synchronize C and Python implementation of the io module about pickling (GH-122628) (GH-133381)
In the C implementation, remove __reduce__ and __reduce_ex__ methods
that always raise TypeError and restore __getstate__ methods that always
raise TypeErrori.

This restores fine details of the pre-3.12 behavior and unifies
both implementations.
(cherry picked from commit e9253ebf74)
2025-05-04 16:04:09 +00:00
Serhiy Storchaka
3c9d1778ef
[3.13] bpo-44172: Keep reference to original window in curses subwindow objects (GH-26226) (GH-133370)
The X/Open curses specification[0] and ncurses documentation[1]
both state that subwindows must be deleted before the main window.

Deleting the windows in the wrong order causes a double-free with
NetBSD's curses implementation.

To fix this, keep track of the original window object in the subwindow
object, and keep a reference to the original for the lifetime of
the subwindow.

[0] https://pubs.opengroup.org/onlinepubs/7908799/xcurses/delwin.html
[1] https://invisible-island.net/ncurses/man/curs_window.3x.html
(cherry picked from commit 0af61fe2f4)

Co-authored-by: Michael Forney <mforney@mforney.org>
2025-05-04 11:15:43 +00:00
Miss Islington (bot)
e090f8e3f5
[3.13] gh-133210: Fix test_rlcompleter in --without-doc-strings mode (GH-133332) (#133348)
gh-133210: Fix `test_rlcompleter` in `--without-doc-strings` mode (GH-133332)
(cherry picked from commit 881144fa58)

Co-authored-by: sobolevn <mail@sobolevn.me>
2025-05-03 16:01:36 +00:00
Miss Islington (bot)
c9c0beb00d
[3.13] gh-114713: Revert gh-114731 (GH-133330) (#133331)
gh-114713: Revert gh-114731 (GH-133330)

Revert "gh-114713: Handle case of an empty string passed to `zoneinfo.ZoneInfo` (GH-114731)"

This reverts commit 884df116d7.
(cherry picked from commit fe44fc4f43)

Co-authored-by: Kirill Podoprigora <kirill.bast9@mail.ru>
2025-05-03 08:09:54 +00:00
Miss Islington (bot)
e75f528e78
[3.13] gh-133290: Use PyObject_SetAttr to set _type_ (GH-133292) (GH-133295)
gh-133290: Use PyObject_SetAttr to set _type_ (GH-133292)
(cherry picked from commit 2590774c9b)

Co-authored-by: Petr Viktorin <encukou@gmail.com>
2025-05-02 18:10:32 +02:00
Miss Islington (bot)
16e9e74a8b
[3.13] gh-132385: Fix instance error suggestions trigger potential exceptions in traceback (GH-132387) (#133297)
gh-132385: Fix instance error suggestions trigger potential exceptions in `traceback` (GH-132387)
(cherry picked from commit 641253cfac)

Co-authored-by: sobolevn <mail@sobolevn.me>
2025-05-02 13:27:54 +00:00
Miss Islington (bot)
6a919d0488
[3.13] gh-133210: Fix test_descr in --without-doc-strings mode (GH-133294) (#133298)
gh-133210: Fix `test_descr` in `--without-doc-strings` mode (GH-133294)
(cherry picked from commit ba16ba3a18)

Co-authored-by: sobolevn <mail@sobolevn.me>
2025-05-02 13:27:30 +00:00