Commit graph

124232 commits

Author SHA1 Message Date
Mark Shannon
132bdf6990
[3.13] GH-127682: Backport GH-132351 (GH-132384)
Only call `__iter__` once in generator expressions
2025-04-29 09:35:29 +01:00
Donghee Na
7ffef8d07b
[3.13] gh-132070: Use _PyObject_IsUniquelyReferenced in unicodeobject (gh-133039) (gh-133126)
* gh-132070: Use _PyObject_IsUniquelyReferenced in unicodeobject (gh-133039)

---------
(cherry picked from commit 75cbb8d89e)

Co-authored-by: Donghee Na <donghee.na@python.org>
Co-authored-by: Kumar Aditya <kumaraditya@python.org>
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>

* Add _PyObject_IsUniquelyReferenced

---------

Co-authored-by: Kumar Aditya <kumaraditya@python.org>
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2025-04-29 14:26:44 +09:00
Neil Schemenauer
64dcbb0c31
[3.13] gh-133122: Fix for test_type_lookup_mro_reference. (gh-133127)
Change the unit test case to use `getattr()` so that we avoid the
bytecode specializer optimizing the access.  The specializer will call
the `__eq__` method before the unit test expects, causing it to fail.

In the 3.14 branch (gh-128164) the test is changed in a different way
to avoid the same issue.
2025-04-29 03:33:13 +00:00
Neil Schemenauer
ca46ec85f8
[3.13] gh-132942: Fix races in type lookup cache (gh-133114)
Two races related to the type lookup cache, when used in the
free-threaded build.  This caused test_opcache to sometimes fail (as
well as other hard to re-produce failures).
2025-04-28 22:08:09 +00:00
Miss Islington (bot)
b71442f44f
[3.13] gh-132742: Fix newly added tcflush() tests on Android (GH-133070) (GH-133104)
(cherry picked from commit 25186c2472)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2025-04-28 19:10:42 +00:00
sobolevn
ab89f6ec84
[3.13] gh-133054: Skip test_pyrepl tests when cannot use pyrepl is reported (GH-133055) (#133095)
(cherry picked from commit b739ec5ab7)

Co-authored-by: Tomas R. <tomas.roun8@gmail.com>
2025-04-28 18:00:42 +00:00
Miss Islington (bot)
507b4fa7a4
[3.13] gh-132026: Ensure _MIPS_SIM has defined _ABI identifiers for comparison (GH-133092)
When built on a MIPS architecture, `_MIPS_SIM` is used to determine
architecture specifics. The value is expected to match either
`_ABIO32`, `_ABIN32` or `_ABI64`.

In `gcc` config/mips/mips.h these values are defined as compiler
`builtin_define` inside of a switch/case. That means, mips64el and
mips64 architectures know about `_ABI64` but don't know about `_ABIO32`
and `_ABIN32`. In turn, when CPython tries to use them in comparison,
they may be undefined identifiers.

In default compiler behavior, the undefined identifier will be
evaluated as zero, and it will not match `_MIPS_SIM`. However, the
issues pop up when `-Wundef` (or, even worse, `-Werror=undef`) compiler
flag is enabled. Then suddenly it's visible as a warning or error.
(cherry picked from commit 6985e2e6de)

Co-authored-by: Valters Jansons <sigv@users.noreply.github.com>
2025-04-28 12:15:45 -05:00
Miss Islington (bot)
85882ca0e7
[3.13] gh-132726: Change the heading of sysconfig CLI section (GH-133035) (#133088)
Co-authored-by: Semyon Moroz <donbarbos@proton.me>
2025-04-28 15:19:46 +00:00
Miss Islington (bot)
6ade0c3b2b
[3.13] gh-133033: Add docs for TypeIgnore (GH-133034) (#133078)
gh-133033: Add docs for `TypeIgnore` (GH-133034)
(cherry picked from commit 4e04511cb9)

Co-authored-by: Yuki Kobayashi <drsuaimqjgar@gmail.com>
Co-authored-by: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com>
2025-04-28 10:55:19 +00:00
Serhiy Storchaka
0d53872443
[3.13] gh-132742: Improve tests for fcntl.ioctl() (GH-132791) (GH-133066)
* Use better tests for integer argument.
* Add also parallel tests for tcflush() and tcflow().
(cherry picked from commit ed8e886f4f)
2025-04-28 08:23:43 +00:00
Miss Islington (bot)
154225bb33
[3.13] gh-133046: Reformat the `ast` module docstring (GH-133050) (GH-133060)
gh-133046: Reformat the ``ast`` module docstring (GH-133050)

* Fix formatting in module docstring for `ast` https://github.com/python/cpython/issues/133046
* GH-133046 ast docstring: remove header, dedent, 80-char width.
* Keep existing wrapping

---------
(cherry picked from commit 6d53b75283)

Co-authored-by: Hunter Hogan <hunterhogan@users.noreply.github.com>
Co-authored-by: Adam Turner <9087854+aa-turner@users.noreply.github.com>
2025-04-27 21:59:41 +00:00
Miss Islington (bot)
8fdc10686b
[3.13] [tests] fix test_fcntl issue when run in a ChromeOS linux runtime (GH-133053) (GH-133056)
[tests] fix test_fcntl issue when run in a ChromeOS linux runtime (GH-133053)

* [tests] test_fcntl fails when run in a ChromeOS linux runtime container.

It doesn't appear to support F_NOTIFY? Detect the lack of that and skip the test.
(cherry picked from commit 355ee1a429)

Co-authored-by: Gregory P. Smith <greg@krypto.org>
2025-04-27 20:54:37 +00:00
Miss Islington (bot)
fdcaaad1cc
[3.13] gh-63882: Implement some test_minidom tests (GH-132879) (#133029)
Co-authored-by: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com>
Co-authored-by: Julian Gindi <julian@gindi.io>
Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
2025-04-26 20:28:00 +00:00
Miss Islington (bot)
3a1a2a0b49
[3.13] gh-133016: Fix a reference to removed asyncio.futures.TimeoutError (GH-133019) (#133023)
gh-133016: Fix a reference to removed `asyncio.futures.TimeoutError` (GH-133019)

Just use the builtin `TimeoutError`, and remove the import of `futures`.
(cherry picked from commit 8d6d7386a3)

Co-authored-by: John <john-xyz@outlook.com>
2025-04-26 19:46:11 +00:00
Miss Islington (bot)
4031902949
[3.13] gh-63882: Use self.assert* methods in test_minidom (GH-133000) (#133024)
Co-authored-by: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com>
2025-04-26 19:21:22 +00:00
Hugo van Kemenade
2c9842f7ac
[3.13] doc: update co_flags reference (GH-132300) (#132936)
Co-authored-by: Inada Naoki <songofacandy@gmail.com>
2025-04-26 21:47:51 +03:00
Victor Stinner
994529da92
[3.13] Revert "[3.13] gh-132921: Fix setuptools._distutils.dep_util deprecation (GH-132923) (#132926)" (#133004)
Revert "[3.13] gh-132921: Fix setuptools._distutils.dep_util deprecation (GH-132923) (#132926)"

This reverts commit 3776ade2e8.

setuptools.modified module is not available on old setuptools
versions.
2025-04-26 12:53:03 +00:00
Miss Islington (bot)
41e19a78b2
[3.13] gh-91221: fix test_curses.test_use_default_colors for xterm-256color (GH-132990) (#132992)
gh-91221: fix `test_curses.test_use_default_colors` for xterm-256color (GH-132990)

Terminals with `xterm-256color` Xterm support may use 15 (bright white) as their default foreground color.
(cherry picked from commit 7f02ded29f)

Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
2025-04-26 11:02:17 +00:00
Miss Islington (bot)
08772229c7
[3.13] gh-132684: [Enum] only call _missing_ in __contains__ for Flags (GH-132790) (GH-132896)
gh-132684: [Enum] only call _missing_ in __contains__ for Flags (GH-132790)
(cherry picked from commit 22bc953aa9)

Co-authored-by: Ethan Furman <ethan@stoneleaf.us>
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
2025-04-25 13:30:33 -07:00
Miss Islington (bot)
3ff35ba471
[3.13] gh-132527: Added missing w typecode to array() error message (GH-132529) (#132938)
Co-authored-by: Christian Veenhuis <124370897+ChVeen@users.noreply.github.com>
Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
Co-authored-by: Tomas R. <tomas.roun8@gmail.com>
2025-04-25 17:12:02 +03:00
Miss Islington (bot)
76840557bc
[3.13] gh-132912: Set 15 min timeout on GHA Hypothesis CI (GH-132914) (#132937)
gh-132912: Set 15 min timeout on GHA Hypothesis CI (GH-132914)
(cherry picked from commit eb2e430b88)

Co-authored-by: Victor Stinner <vstinner@python.org>
2025-04-25 13:54:36 +00:00
Bénédikt Tran
7ebfc6ec5e
[3.13] gh-132909: handle overflow for 'K' format in do_mkvalue (GH-132911) (#132932)
(cherry picked from commit 3fa024dec3)
2025-04-25 12:44:53 +00:00
Miss Islington (bot)
3776ade2e8
[3.13] gh-132921: Fix setuptools._distutils.dep_util deprecation (GH-132923) (#132926)
gh-132921: Fix setuptools._distutils.dep_util deprecation (GH-132923)

Replace setuptools._distutils.dep_util with setuptools.modified in
peg_generator compile_c_extension().
(cherry picked from commit 1a70f66ea8)

Co-authored-by: Victor Stinner <vstinner@python.org>
2025-04-25 11:55:22 +00:00
Miss Islington (bot)
b4a160ac59
[3.13] gh-132415: Use shutil.which() in missing_compiler_executable() (GH-132906) (#132916)
gh-132415: Use shutil.which() in missing_compiler_executable() (GH-132906)

Replace deprecated distutils.spawn.find_executable() with
shutil.which() in missing_compiler_executable() of test.support.
(cherry picked from commit de6482eda3)

Co-authored-by: Victor Stinner <vstinner@python.org>
2025-04-25 10:41:40 +00:00
Miss Islington (bot)
8a759c235c
[3.13] gh-127906: Add missing sys import to test_cppext (GH-132902) (#132904)
gh-127906: Add missing sys import to test_cppext (GH-132902)
(cherry picked from commit 9cba14881b)

Co-authored-by: Victor Stinner <vstinner@python.org>
2025-04-25 08:42:57 +00:00
Miss Islington (bot)
293f2895d5
[3.13] gh-98347: Add links to python-isal in the documentation (GH-98637) (#132894)
gh-98347: Add links to python-isal in the documentation (GH-98637)

Clearly note that this is primarily intended for users for who zlib/gzip is a bottleneck.
(cherry picked from commit b1fc8b69ec)

Co-authored-by: Ruben Vorderman <r.h.p.vorderman@lumc.nl>
Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
2025-04-25 03:09:58 +01:00
Miss Islington (bot)
9953971924
[3.13] Differentiate bitwise OR from the word "or" (GH-132890) (#132891)
Differentiate bitwise OR from the word "or" (GH-132890)
(cherry picked from commit 15ff60aff0)

Co-authored-by: Brett Cannon <brett@python.org>
2025-04-24 22:11:18 +00:00
Serhiy Storchaka
bf6c74dc7a
[3.13] Use os.openpty() instead of pty.openpty() in test_ioctl (GH-132878)
pty.openpty() does not work on Android, and it is easier to check
availability of os.openpty.
2025-04-24 18:47:01 +03:00
Miss Islington (bot)
52e0f564d0
[3.13] Fix a grammar error in the Py_ALWAYS_INLINE doc (GH-129304) (#132877)
Co-authored-by: Kuba_Z2 <77853483+KubaZ2@users.noreply.github.com>
2025-04-24 14:27:41 +00:00
Miss Islington (bot)
9ec6f77f8a
[3.13] gh-128185: Align Decimal docs with spec (case irrelevant for nan/inf) (GH-128323) (#132875)
Co-authored-by: Sergey B Kirpichev <skirpichev@gmail.com>
2025-04-24 14:09:03 +00:00
Miss Islington (bot)
bd4a39f125
[3.13] gh-122399: change webbrowser.rst to better describe the contents of controller object (GH-122407) (#132874)
Co-authored-by: Jordi Burguet-Castell <jordi.burguet.castell@gmail.com>
Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
2025-04-24 14:03:02 +00:00
Miss Islington (bot)
b220c1c0a4
[3.13] gh-109981: Resolve situation on iOS regarding fd_count. (GH-132823) (#132824)
Modifies the test helper that counts the list of open file descriptors to use
the optimised ``/dev/fd`` approach on all Apple platforms, not just macOS. This
avoids crashes caused by guarded file descriptors.
(cherry picked from commit 862fd89036)

Co-authored-by: John <johnzhou721@gmail.com>
2025-04-23 21:40:25 +00:00
Serhiy Storchaka
f8d4ca42ae
[3.13] gh-83994, gh-132843: Fix and improve test_ioctl (GH-132848) (GH-132850)
* Skip test_ioctl_tcflush if termios.TCFLSH is not available.
* Do not skip ALL ioctl() tests when /dev/tty is not available.
(cherry picked from commit 4b4b9fbb06)
2025-04-23 19:17:51 +00:00
Miss Islington (bot)
abbc44c557
[3.13] gh-132742: Update documentation for the fcntl module (GH-132765) (GH-132832)
(cherry picked from commit 5f50541ebd)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2025-04-23 21:08:46 +03:00
Miss Islington (bot)
341b86e095
[3.13] gh-132713: Fix typing.Union[index] race condition (GH-132802) (#132839)
gh-132713: Fix typing.Union[index] race condition (GH-132802)

Add union_init_parameters() helper function. Use a critical section
to initialize the 'parameters' member.
(cherry picked from commit dc3e9638c2)

Co-authored-by: Victor Stinner <vstinner@python.org>
2025-04-23 14:12:03 +00:00
Victor Stinner
3de0f55f34
[3.13] gh-132713: Fix repr(list) race condition (#132801) (#132809)
Hold a strong reference to the item while calling repr(item).

(cherry picked from commit a4ea80d523)
2025-04-23 15:44:33 +02:00
sobolevn
3a130c1786
[3.13] Update pre-commit repos (GH-132792) (#132804)
(cherry picked from commit 87b1ea016b)
2025-04-22 15:57:34 +00:00
Miss Islington (bot)
e140e6ef78
[3.13] gh-132769: Refactor possible read-out-of-bounds in lexer.c (GH-132770) (#132788)
gh-132769: Refactor possible read-out-of-bounds in `lexer.c` (GH-132770)
(cherry picked from commit ea8ec95cfa)

Co-authored-by: sobolevn <mail@sobolevn.me>
2025-04-21 22:42:55 +00:00
Gregory P. Smith
cdabbc126f
[3.13] gh-122179: Fix hashlib.file_digest and non-blocking I/O (GH-132787)
gh-122179: Fix hashlib.file_digest and non-blocking I/O (GH-122183)

* Fix hashlib.file_digest and non-blocking I/O
* Add documentation around this behavior
* Add versionchanged

(cherry picked from commit 2b47f46d7d)

Co-authored-by: Sebastian Rittau <srittau@rittau.biz>
2025-04-21 21:55:57 +00:00
Peter Bierma
bb59fdec71
[3.13] gh-132747: Fix NULL dereference when calling a method's __get__ manually (GH-132772) (#132786)
(cherry picked from commit fa70bf8593)

Co-authored-by: Peter Bierma <zintensitydev@gmail.com>
2025-04-21 21:38:51 +00:00
Miss Islington (bot)
d8b9011702
[3.13] gh-85583: Add an overview of formatted string literals (f-strings) to `str` (GH-132689) (#132767)
gh-85583: Add an overview of formatted string literals (f-strings) to ``str`` (GH-132689)
(cherry picked from commit fee808936f)

Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
2025-04-21 08:55:13 +01:00
Serhiy Storchaka
3c29fb2974
[3.13] gh-132753: Argument Clinic: Fix support of c_default for the bool converter (GH-132754) (GH-132766)
(cherry picked from commit 78cfee6f09)
2025-04-21 07:10:31 +00:00
Miss Islington (bot)
c709d3b503
[3.13] gh-132742: Add more tests for fcntl.ioctl() (GH-132756) (GH-132764)
Test with different types of argument: integer, mutable and immutable
buffers, immutable buffer with mutable_flag set to false.
(cherry picked from commit a04390b4da)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2025-04-21 06:49:45 +00:00
Miss Islington (bot)
62663bfed5
[3.13] gh-129098: avoid using content of _pyrepl/__main__.py when reporting tracebacks (GH-130721) (#132755)
gh-129098: avoid using content of `_pyrepl/__main__.py` when reporting tracebacks (GH-130721)
(cherry picked from commit 492e3e6976)

Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
2025-04-20 17:48:16 +00:00
Miss Islington (bot)
5ab628fc65
[3.13] gh-129327: revise hashlib documentation to account for FIPS removing sha1 (GH-132729) (#132740)
gh-129327: revise hashlib documentation to account for FIPS removing sha1 (GH-132729)

* gh-129327: revise hashlib documentation to account for FIPS removing sha1

More generally, the current documentation is a bit scattered, talking
about what terms are "equal" despite those terms not being very
interesting and given the term "secure hash", probably wrong (because
md5 and sha1 are not secure anymore).

Let's talk about cryptographically secure instead, and note that two of
them aren't. And then we can also link to the source for NIST going
through the removal process for SHA1.

* Add Gregors Suggestion

* Clean up

---------
(cherry picked from commit a16586c9e7)

Co-authored-by: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com>
Co-authored-by: Eli Schwartz <eschwartz@gentoo.org>
2025-04-20 01:12:26 +00:00
Peter Bierma
47c8df6172
[3.13] gh-132673: Fix a crash with zero-alignment in ctypes.Structure (#132695) 2025-04-19 14:29:05 +00:00
Miss Islington (bot)
38f305b9db
[3.13] Docs: Fix REPL example in Doc/library/shutil.rst (GH-132700) (#132728)
Docs: Fix REPL example in `Doc/library/shutil.rst` (GH-132700)
(cherry picked from commit e154e4db36)

Co-authored-by: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com>
2025-04-19 14:20:46 +00:00
Miss Islington (bot)
83cb89b941
[3.13] gh-129719: Restore missing socket.CAN_RAW_ERR_FILTER on Linux (GH-129721) (#132702)
gh-129719: Restore missing `socket.CAN_RAW_ERR_FILTER` on Linux (GH-129721)
(cherry picked from commit ce31ae5209)

Co-authored-by: Jeroen Bogers <11465689+jbogers@users.noreply.github.com>
Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
Co-authored-by: Peter Bierma <zintensitydev@gmail.com>
2025-04-18 20:49:23 +00:00
Miss Islington (bot)
10f37b36b4
[3.13] gh-132396: Resolve 'redefinition of unused name' errors in `Lib/test/` (GH-132397) (#132699)
gh-132396: Resolve 'redefinition of unused name' errors in ``Lib/test/`` (GH-132397)
(cherry picked from commit 1d5dc5f1c3)

Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
2025-04-18 20:35:35 +01:00
Miss Islington (bot)
151828d520
[3.13] Minor doc edit: Make multinomial() the first math example (gh-132697) (gh-132698) 2025-04-18 17:47:25 +00:00