Commit graph

120239 commits

Author SHA1 Message Date
Miss Islington (bot)
e5ab9e3740
[3.12] gh-112064: Fix incorrect handling of negative read sizes in HTTPResponse.read() (GH-128270) (#129396)
gh-112064: Fix incorrect handling of negative read sizes in `HTTPResponse.read()` (GH-128270)

The parameter `amt` of `HTTPResponse.read()`, which could be a negative integer,
has not been handled before and led to waiting for the connection to close
for `keep-alive connections`. Now, this has been fixed, and passing negative values
to `HTTPResponse().read()` works the same as passing `None` value.
(cherry picked from commit 4d0d24f6e3)

Co-authored-by: Yury Manushkin <manushkin@gmail.com>
2025-01-28 11:54:27 +00:00
Miss Islington (bot)
ea143e67b3
[3.12] gh-85046: Document errno constants (GH-126420) (#129384)
(cherry picked from commit 1c3bb200da)

Co-authored-by: RUANG (James Roy) <longjinyii@outlook.com>
2025-01-28 00:20:13 +00:00
Miss Islington (bot)
2df8b395b0
[3.12] gh-119511: Fix a potential denial of service in imaplib (GH-119514) (GH-129356)
gh-119511: Fix a potential denial of service in imaplib (GH-119514)

The IMAP4 client could consume an arbitrary amount of memory when trying
to connect to a malicious server, because it read a "literal" data with a
single read(size) call, and BufferedReader.read() allocates the bytes
object of the specified size before reading. Now the IMAP4 client reads data
by chunks, therefore the amount of used memory is limited by the
amount of the data actually been sent by the server.
(cherry picked from commit 735f25c5e3)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
Co-authored-by: Gregory P. Smith <greg@krypto.org>
2025-01-27 14:06:14 -08:00
Miss Islington (bot)
23faf5f2dc
[3.12] gh-129346: Handle allocation errors for SQLite aggregate context (GH-129347) (#129373)
(cherry picked from commit 379ab856f5)

Co-authored-by: Erlend E. Aasland <erlend@python.org>
2025-01-27 17:33:18 +00:00
Miss Islington (bot)
6073f04b73
[3.12] gh-126022: Remove zope.org from the permitted linkcheck redirects (GH-129308) (#129318)
Co-authored-by: partev <petrosyan@gmail.com>
2025-01-26 14:53:46 +00:00
Miss Islington (bot)
0d53d7afd5
[3.12] gh-71339: Use new assertion methods in test_idle (GH-129314) (#129315)
Revise 10 tests in 7 files, with 1 test split into 2.
(cherry picked from commit 1499f66c4c)
Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
2025-01-26 05:33:44 -05:00
Adam Turner
53204a11f1
[3.12] GH-121970: Remove pyspecific `PyDecoratorMixin` patches (GH-129306) (#129310)
(cherry picked from commit 0ef8d470b7)
2025-01-26 03:54:26 +00:00
Miss Islington (bot)
c17d30bf34
[3.12] gh-58956: Set f_trace on frames with breakpoints after setting a new breakpoint (GH-124454) (#125549)
* gh-58956: Set f_trace on frames with breakpoints after setting a new breakpoint (GH-124454)
(cherry picked from commit 12eaadc0ad)

Co-authored-by: Tian Gao <gaogaotiantian@hotmail.com>
2025-01-25 15:12:19 -05:00
Hugo van Kemenade
5431cfac11
[3.12] gh-126022: make license.rst consistent with LICENSE (GH-128516) (#129291)
Co-authored-by: partev <petrosyan@gmail.com>
2025-01-25 15:37:20 +02:00
Miss Islington (bot)
9c44e4fcb1
[3.12] GH-125722: Remove Sphinx patches (GH-129277) (#129279)
GH-125722: Remove Sphinx patches (GH-129277)
(cherry picked from commit d40692db06)

Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
2025-01-25 03:57:35 +00:00
Miss Islington (bot)
e94939cedb
[3.12] gh-128479: fix asyncio staggered race leaking tasks, and logging unhandled exception.append exception (GH-128475) (#129228)
gh-128479: fix asyncio staggered race leaking tasks, and logging unhandled exception.append exception (GH-128475)
(cherry picked from commit ec91e1c276)

Co-authored-by: Thomas Grainger <tagrain@gmail.com>
Co-authored-by: Peter Bierma <zintensitydev@gmail.com>
2025-01-23 22:16:21 +01:00
Victor Stinner
bb7c54d5ba
[3.12] gh-129185: Fix PyTraceMalloc_Untrack() at Python exit (#129191) (#129217) (#129221)
[3.13] gh-129185: Fix PyTraceMalloc_Untrack() at Python exit (#129191) (#129217)

gh-129185: Fix PyTraceMalloc_Untrack() at Python exit (#129191)

Support calling PyTraceMalloc_Track() and PyTraceMalloc_Untrack()
during late Python finalization.

* Call _PyTraceMalloc_Fini() later in Python finalization.
* Test also PyTraceMalloc_Untrack() without the GIL
* PyTraceMalloc_Untrack() now gets the GIL.
* Test also PyTraceMalloc_Untrack() in test_tracemalloc_track_race().

(cherry picked from commit 46c7e13c05)
(cherry picked from commit e3b3e01d6a)
2025-01-23 13:29:46 +00:00
Hugo van Kemenade
880ad1813e
[3.12] Add colour to GitHub Actions output (GH-129196) (#129199) 2025-01-22 21:50:35 +00:00
Pablo Galindo Salgado
9ed04d9516
[3.12] gh-124363: Treat debug expressions in f-string as raw strings (GH-128399) (#129190)
(cherry picked from commit 60a3a0dd6f)

Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
2025-01-22 18:08:58 +00:00
Pablo Galindo Salgado
e577ff4ce4
[3.12] gh-129093: Fix f-string debug text sometimes getting cut off when expression contains ! (#129164) 2025-01-22 00:47:20 +00:00
nikalinov
b849a1b751
[3.12] gh-129044: Update glossary entry for 'loader' to reflect current import system (#129073) (#129130)
* gh-129044: Update glossary entry for 'loader' to reflect current import system (#129073)

Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
(cherry picked from commit e1fa2fcc7c)

Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
2025-01-21 23:49:49 +00:00
Miss Islington (bot)
c75dcae879
[3.12] gh-122845: fix parameter_list_starargs in function definition pseudo-grammar (GH-122847) (#129151)
gh-122845: fix parameter_list_starargs in function definition pseudo-grammar (GH-122847)

Thanks to Artur Chakhvadze for bugfix.
(cherry picked from commit 6105846390)

Co-authored-by: Sergey B Kirpichev <skirpichev@gmail.com>
2025-01-21 20:12:46 +00:00
Miss Islington (bot)
0b66037993
[3.12] Docs: fix typo in Doc/howto/mro.rst (GH-129095) (GH-129121)
(cherry picked from commit da310d209a)

Co-authored-by: smelnikov <13030121+smelnikov@users.noreply.github.com>
2025-01-21 10:40:38 +01:00
Thomas Grainger
bc214545f9
[3.12] gh-128588: fix refcycles in eager task creation and remove eager tasks optimization that missed and introduced incorrect cancellations (#129063) (#128586)
Co-authored-by: Kumar Aditya <kumaraditya@python.org>
2025-01-21 11:11:39 +05:30
Miss Islington (bot)
23cb53a312
[3.12] GH-121970: Extract `changes` into a new extension (GH-129105) (#129110)
GH-121970: Extract ``changes`` into a new extension (GH-129105)
(cherry picked from commit e54ac3b69e)

Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
2025-01-20 23:59:59 +00:00
Miss Islington (bot)
9b335cc810
[3.12] gh-111178: fix UBSan failures in Modules/_multiprocessing/semaphore.c (GH-129084) (#129101)
gh-111178: fix UBSan failures in `Modules/_multiprocessing/semaphore.c` (GH-129084)

fix UBSan failures for `SemLockObject`
(cherry picked from commit 5ed5572cac)

Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
2025-01-20 21:00:09 +00:00
Miss Islington (bot)
03bce18992
[3.12] GH-128131: Completely support random read access of uncompressed unencrypted files in ZipFile (GH-128143) (#129092)
GH-128131: Completely support random read access of uncompressed unencrypted files in ZipFile (GH-128143)
(cherry picked from commit dda02eb7be)

Co-authored-by: 5ec1cff <56485584+5ec1cff@users.noreply.github.com>
Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
2025-01-20 20:40:28 +00:00
Miss Islington (bot)
728c6b89a6
[3.12] doc: fix venv creating for the local Python using uv (GH-129094) (#129097)
Co-authored-by: Filipe Laíns 🇵🇸 <lains@riseup.net>
2025-01-20 21:13:23 +02:00
Miss Islington (bot)
e6cb31a098
[3.12] Docs C API: Clarify what happens when null bytes are passed to PyUnicode_AsUTF8 (GH-127458) (#129081)
Docs C API: Clarify what happens when null bytes are passed to `PyUnicode_AsUTF8` (GH-127458)
(cherry picked from commit e792f4bc2e)

Co-authored-by: Peter Bierma <zintensitydev@gmail.com>
Co-authored-by: Stan U. <89152624+StanFromIreland@users.noreply.github.com>
Co-authored-by: Tomas R. <tomas.roun8@gmail.com>
Co-authored-by: Victor Stinner <vstinner@python.org>
2025-01-20 16:06:18 +00:00
Serhiy Storchaka
032058cb62
[3.12] gh-71339: Add additional assertion methods in test.support (GH-128707) (GH-128815) (GH-129059)
Add a mix-in class ExtraAssertions containing the following methods:

* assertHasAttr() and assertNotHasAttr()
* assertIsSubclass() and assertNotIsSubclass()
* assertStartsWith() and assertNotStartsWith()
* assertEndsWith() and assertNotEndsWith()

(cherry picked from commit c6a566e47b)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
(cherry picked from commit 06cad77a5b)
2025-01-20 12:06:02 +00:00
Miss Islington (bot)
7f68e7bf2a
[3.12] Fix a typo in syslog's error message (GH-129029) (#129050)
Fix a typo in `syslog`'s error message (GH-129029)
(cherry picked from commit 9b1c1817af)

Co-authored-by: Tomas R <tomas.roun8@gmail.com>
2025-01-20 10:28:55 +00:00
Miss Islington (bot)
49b2f31a6b
[3.12] GH-125722: Use long options for Sphinx (GH-129039) (#129042)
GH-125722: Use long options for Sphinx (GH-129039)
(cherry picked from commit 4967fa6a9c)

Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
2025-01-20 09:17:35 +02:00
Miss Islington (bot)
6f19c6a705
[3.12] GH-125722: Increase minimum supported Sphinx to 8.1.3 (GH-128922) (#129038)
(cherry picked from commit d46b577ec0)

Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
2025-01-20 00:46:05 +00:00
Miss Islington (bot)
22c1d895fc
[3.12] gh-129020: Remove ambiguous sentence from tokenize.untokenize docs (GH-129021) (#129036)
gh-129020: Remove ambiguous sentence from `tokenize.untokenize` docs (GH-129021)
(cherry picked from commit bca35f0e78)

Co-authored-by: Tomas R <tomas.roun8@gmail.com>
2025-01-20 00:12:39 +00:00
Miss Islington (bot)
b8170e5884
[3.12] gh-80222: Fix email address header folding with long quoted-string (GH-122753) (#129008)
gh-80222: Fix email address header folding with long quoted-string (GH-122753)

Email generators using email.policy.default could incorrectly omit the
quote ('"') characters from a quoted-string during header refolding,
leading to invalid address headers and enabling header spoofing. This
change restores the quote characters on a bare-quoted-string as the
header is refolded, and escapes backslash and quote chars in the string.
(cherry picked from commit 5aaf416858)

Co-authored-by: Mike Edmunds <medmunds@gmail.com>
2025-01-19 16:07:39 -05:00
Victor Stinner
fceb8c31dd
[3.12] gh-111495: Add more tests on PyEval C APIs (#122789) (#128987) (#129023)
* Add Lib/test/test_capi/test_eval.py
* Add Modules/_testlimitedcapi/eval.c

(cherry picked from commit bf8b374639)

* gh-111495: Fix refleaks in test_capi.test_eval tests (#122851)

(cherry picked from commit b4a316087c)
(cherry picked from commit 430ccbc009)
2025-01-19 13:51:53 +00:00
Victor Stinner
6df22cbf60
[3.12] gh-128679: Fix tracemalloc.stop() race conditions (#128897) (#129022)
[3.13] gh-128679: Fix tracemalloc.stop() race conditions (#128897)

tracemalloc_alloc(), tracemalloc_realloc(), PyTraceMalloc_Track(),
PyTraceMalloc_Untrack() and _PyTraceMalloc_TraceRef() now check
tracemalloc_config.tracing after calling TABLES_LOCK().

_PyTraceMalloc_Stop() now protects more code with TABLES_LOCK(),
especially setting tracemalloc_config.tracing to 1.

Add a test using PyTraceMalloc_Track() to test tracemalloc.stop()
race condition.

Call _PyTraceMalloc_Init() at Python startup.

(cherry picked from commit 6b47499510)
2025-01-19 13:24:14 +00:00
Serhiy Storchaka
83de72e5ec
[3.12] gh-128911: Add tests on the PyImport C API (GH-128915) (GH-128960) (#128989)
* Add Modules/_testlimitedcapi/import.c
* Add Lib/test/test_capi/test_import.py
* Remove _testcapi.check_pyimport_addmodule(): tests already covered
  by newly added tests.
(cherry picked from commit 34ded1a1a1)

Co-authored-by: Victor Stinner <vstinner@python.org>
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
(cherry picked from commit d95ba9fa11)
2025-01-19 14:21:55 +01:00
Tian Gao
6d638c2655
[3.12] gh-128991: Release the enter frame reference within bdb callba… (#129003)
[3.12] gh-128991: Release the enter frame reference within bdb callback (GH-128992)

* Release the enter frame reference within bdb callback

* 📜🤖 Added by blurb_it.

---------

(cherry picked from commit 61b35f74aa)
2025-01-18 17:21:34 -05:00
Miss Islington (bot)
ae8c8b7ffd
[3.12] gh-128998: Fix indentation of numbered list and literal block (GH-128999) (#129001)
gh-128998: Fix indentation of numbered list and literal block (GH-128999)
(cherry picked from commit e8092e5cdc)

Co-authored-by: Rafael Fontenelle <rffontenelle@users.noreply.github.com>
Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
2025-01-18 21:00:14 +00:00
Peter Bierma
4219cda83d
[3.12] Pre-commit: Drop specific language version and bump hooks (GH-128801) (#128997) 2025-01-18 22:52:24 +02:00
Miss Islington (bot)
104d37ad99
[3.12] gh-121542: Document trailing newline behavior in set_content() (GH-121543) (#128996)
gh-121542: Document trailing newline behavior in `set_content()` (GH-121543)
(cherry picked from commit fba475ae6f)

Co-authored-by: Peter Bierma <zintensitydev@gmail.com>
Co-authored-by: Yizheng Meng <dev@rapidcow.org>
2025-01-18 18:41:59 +00:00
Ed Nutting
bca489076f
[3.12] gh-127599: Fix _Py_RefcntAdd missing calls to _Py_INCREF_STAT_INC/_Py_INCREF_IMMORTAL_STAT_INC (GH-127717) (#128712)
Previously, `_Py_RefcntAdd` hasn't called
`_Py_INCREF_STAT_INC/_Py_INCREF_IMMORTAL_STAT_INC` which is incorrect.

Now it has been fixed.
(cherry picked from commit ab05beb8ce)
2025-01-18 19:00:18 +02:00
Bénédikt Tran
3d9b14c19b
[3.12] gh-125997: suggest efficient alternatives for time.sleep(0) (GH-128752) (#128985) 2025-01-18 11:13:03 +00:00
Bénédikt Tran
fbbef609d1
[3.12] gh-127637: add tests for dis command-line interface (#127759) (#127780) 2025-01-18 12:01:56 +01:00
Miss Islington (bot)
405f6d72bb
[3.12] gh-128961: Fix exhausted array iterator crash in __setstate__() (GH-128962) (#128977)
(cherry picked from commit 4dade055f4)

Co-authored-by: Tomasz Pytel <tompytel@gmail.com>
2025-01-18 10:14:07 +00:00
Miss Islington (bot)
8a8f5d636d
[3.12] gh-128916: Do not set SO_REUSEPORT on non-AF_INET* sockets (GH-128933) (#128970)
gh-128916: Do not set `SO_REUSEPORT` on non-`AF_INET*` sockets (GH-128933)

* gh-128916: Do not set `SO_REUSEPORT` on non-`AF_INET*` sockets

Do not attempt to set ``SO_REUSEPORT`` on sockets of address familifies other
than ``AF_INET`` and ``AF_INET6``, as it is meaningless with these address
families, and the call with fail with Linux kernel 6.12.9 and newer.

* Apply suggestions from code review



---------
(cherry picked from commit 3829104ab4)

Co-authored-by: Michał Górny <mgorny@gentoo.org>
Co-authored-by: Vinay Sajip <vinay_sajip@yahoo.co.uk>
2025-01-18 01:06:45 +00:00
Miss Islington (bot)
8ee250bdd9
[3.12] Fix definition of a generator iterator in glossary.rst (GH-128952) (#128968)
Fix definition of a `generator iterator` in `glossary.rst` (GH-128952)

Fix possible typo/grammar in glossary.rst

As discussed in https://discuss.python.org/t/typo-in-glossary-entry-for-generator-iterator/77163
(cherry picked from commit 8174770d31)

Co-authored-by: Daniel F Moisset <dfmoisset@gmail.com>
2025-01-18 00:53:29 +00:00
Tian Gao
f45da82c11
[3.12] gh-58956: Fix a frame refleak in bdb (GH-128190) (#128953)
* [3.12] gh-58956: Fix a frame refleak in bdb (GH-128190)
(cherry picked from commit 767c89ba7c)

Co-authored-by: Tian Gao <gaogaotiantian@hotmail.com>
2025-01-17 14:19:37 -05:00
Miss Islington (bot)
dfd75dfeed
[3.12] gh-58689: Fix os.kill() error handling on Windows (GH-128932) (#128938)
gh-58689: Fix os.kill() error handling on Windows (GH-128932)
(cherry picked from commit 939df0f9f6)

Co-authored-by: Victor Stinner <vstinner@python.org>
2025-01-17 12:48:24 +00:00
Miss Islington (bot)
1c85f1bc44
[3.12] gh-128017: Make a note that sys variables are read-only (GH-128887) (#128909)
gh-128017: Make a note that sys variables are read-only (GH-128887)
(cherry picked from commit 313b96eb8b)

Co-authored-by: Srinivas Reddy Thatiparthy (తాటిపర్తి శ్రీనివాస్  రెడ్డి) <thatiparthysreenivas@gmail.com>
2025-01-16 10:23:48 +00:00
Miss Islington (bot)
45b89bf0da
[3.12] gh-128816: Fix warnings in test_doctest (GH-128817) (GH-128871)
* Fix a deprecation warning for using importlib.resources.abc.ResourceReader.
* Fix an import warning when importing readline (if it has not yet been imported).
(cherry picked from commit 599be687ec)

Co-authored-by: Thomas Grainger <tagrain@gmail.com>
2025-01-16 09:09:13 +00:00
Miss Islington (bot)
0308bcfa04
[3.12] gh-97850: Suggest TraversableResources as the alternative for ResourceLoader (GH-128601) (GH-128896)
gh-97850: Suggest `TraversableResources` as the alternative for `ResourceLoader` (GH-128601)

Suggest TraversableResources as the alternative for ResourceLoader.

Previously, ResourceReader was the suggested alternative, but it
is itself deprecated in favour of TraversableResources.
(cherry picked from commit 256d6d2131)

Co-authored-by: Tomas R <tomas.roun8@gmail.com>
2025-01-15 20:55:06 +00:00
Miss Islington (bot)
85255c4df2
[3.12] gh-67206: Document that string.printable is not printable in the POSIX sense (GH-128820) (#128867)
gh-67206: Document that `string.printable` is not printable in the POSIX sense (GH-128820)
(cherry picked from commit d906bde250)

Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
2025-01-15 14:28:21 +00:00
Miss Islington (bot)
5675e06eca
[3.12] gh-128874: Fix the documentation for blurb 2.0 (GH-128875) (#128878)
gh-128874: Fix the documentation for blurb 2.0 (GH-128875)
(cherry picked from commit 40a4d88a14)

Co-authored-by: Victor Stinner <vstinner@python.org>
2025-01-15 14:20:08 +00:00