1067 Commits

Author SHA1 Message Date
Miss Islington (bot)
dced1a788a
[3.13] gh-140648: Make asyncio REPL respect the -I flag (isolated mode) (GH-143045) (#143384)
gh-140648: Make asyncio REPL respect the `-I` flag (isolated mode) (GH-143045)
(cherry picked from commit e7c542de5f069a4b83e8eded3067613e4d59a529)

Co-authored-by: Bartosz Sławecki <bartosz@ilikepython.com>
2026-01-03 08:25:52 +00:00
Miss Islington (bot)
96bc410fec
[3.13] gh-143046: Make asyncio REPL respect the -q flag (quiet mode) (GH-143047) (#143061)
gh-143046: Make asyncio REPL respect the `-q` flag (quiet mode) (GH-143047)
(cherry picked from commit 6213a512bf42464e35ae5090358b80aaa64904cc)

Co-authored-by: Bartosz Sławecki <bartosz@ilikepython.com>
2025-12-22 13:48:28 +05:30
Miss Islington (bot)
d6aa7e1d3d
[3.13] gh-142784: make the asyncio REPL call loop.close() at exit (GH-142785) (#142932)
gh-142784: make the asyncio REPL call `loop.close()` at exit (GH-142785)
(cherry picked from commit ddfc155d3ade5f4867c6789136df73f61d4efb03)

Co-authored-by: Bartosz Sławecki <bartosz@ilikepython.com>
2025-12-18 22:34:03 +05:30
Miss Islington (bot)
7957bfd1ac
[3.13] gh-90871: fix connection backlog offset in asyncio (gh-134392) (#142739)
gh-90871: fix connection backlog offset in asyncio (gh-134392)
(cherry picked from commit 109f7597d29f0b504e9b42cb398b44177157abaa)

Co-authored-by: Christian Harries <68507104+ChristianHrs@users.noreply.github.com>
Co-authored-by: Łukasz Langa <lukasz@langa.pl>
Co-authored-by: Kumar Aditya <kumaraditya@python.org>
2025-12-15 06:12:12 +00:00
Miss Islington (bot)
18bd88f899
[3.13] gh-127529: Correct asyncio's accept_connection behaviour for handling ConnectionAbortedError (GH-127532) (#142738)
gh-127529: Correct asyncio's `accept_connection` behaviour for handling `ConnectionAbortedError` (GH-127532)
(cherry picked from commit 830e10651b1f45cd0af36ff611397b9f53171220)

Co-authored-by: jb2170 <email@jb2170.com>
Co-authored-by: Kumar Aditya <kumaraditya@python.org>
2025-12-15 05:44:52 +00:00
Miss Islington (bot)
b2fff0ea85
[3.13] gh-105836: Fix asyncio.run_coroutine_threadsafe leaving underlying cancelled asyncio task running (GH-141696) (#142359)
gh-105836: Fix `asyncio.run_coroutine_threadsafe` leaving underlying cancelled asyncio task running (GH-141696)
(cherry picked from commit 14715e3a64a674629c781d4a3dd11143ba010990)

Co-authored-by: Kaisheng Xu <iaalmsimon@gmail.com>
Co-authored-by: Kumar Aditya <kumaraditya@python.org>
2025-12-09 20:15:50 +05:30
Miss Islington (bot)
e5b82c433c
[3.13] gh-103847: fix cancellation safety of asyncio.create_subprocess_exec (GH-140805) (#141447)
gh-103847: fix cancellation safety of `asyncio.create_subprocess_exec` (GH-140805)
(cherry picked from commit ef474cfafbdf3aa383fb1334a7ab95cef9834ced)

Co-authored-by: Kumar Aditya <kumaraditya@python.org>
2025-11-13 17:05:01 +05:30
Miss Islington (bot)
54f9613a37
[3.13] gh-139845: do not print twice in default asyncio REPL (GH-139846) (#139860)
gh-139845: do not print twice in default asyncio REPL (GH-139846)
(cherry picked from commit a310b3a99d05e107963023a5736b67afe4ae1968)

Co-authored-by: yihong <zouzou0208@gmail.com>
Co-authored-by: Kumar Aditya <kumaraditya@python.org>
2025-10-09 21:38:04 +05:30
Miss Islington (bot)
060eef27c3
[3.13] gh-136234: Fix SelectorSocketTransport.writelines to be robust to connection loss (GH-136743) (GH-138702) (#139710)
[3.14] gh-136234: Fix `SelectorSocketTransport.writelines` to be robust to connection loss (GH-136743) (GH-138702)
(cherry picked from commit 5cd6cfe4cf6770b9424bb23f8c7c661f7a3db7b0)

Co-authored-by: Kumar Aditya <kumaraditya@python.org>
2025-10-07 17:57:57 +00:00
Miss Islington (bot)
be388836c0
[3.13] gh-138703: clarify data buffer requirement of asyncio.StreamWriter.write (GH-139564) (#139571)
gh-138703: clarify data buffer requirement of `asyncio.StreamWriter.write` (GH-139564)
(cherry picked from commit 0b2168275e8ec491fe7ea6f8c662e804437dfdab)

Co-authored-by: Kumar Aditya <kumaraditya@python.org>
2025-10-04 22:12:03 +05:30
Serhiy Storchaka
1c96723cb1
[3.13] gh-137341: Remove more word duplications (GH-137342) (GH-137347)
(cherry picked from commit 1612dcbafe763014deefd679fe75ac5831a14a43)
2025-08-03 17:24:26 +00:00
Miss Islington (bot)
1b0dfbf209
[3.13] gh-135444: fix asyncio.DatagramTransport.sendto to account for datagram header size when data cannot be sent (GH-135445) (#137246)
gh-135444: fix `asyncio.DatagramTransport.sendto` to account for datagram header size when data cannot be sent (GH-135445)
(cherry picked from commit e3ea8613519bd08aa6ce7d142403e644ae32d843)

Co-authored-by: Justin Bronder <jsbronder@cold-front.org>
Co-authored-by: Kumar Aditya <kumaraditya@python.org>
2025-08-03 10:18:53 +05:30
Miss Islington (bot)
eda613438f
[3.13] Fix Queue.shutdown docs for condition to unblock a join (gh-137088) (gh-137102) 2025-07-25 08:48:28 -06:00
Miss Islington (bot)
d9feec4542
[3.13] Fix docs for Queue.shutdown (gh-137028) (gh-137081) 2025-07-24 11:54:42 -06: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 77fa7a4dcc771bf4d297ebfd4f357483d0750a1c)

Co-authored-by: Justin Su <injustsu@gmail.com>
2025-07-09 09:21:47 +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 9084b151567d02936ea1374961809b69b4cd883d)

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 0e19db653dfa1a6e750e9cede1f6922e5fd1e808)

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)
5987ebc774
[3.13] gh-114177: avoid calling connection lost callbacks when loop is already closed in asyncio subprocess (GH-134508) (#134562)
gh-114177: avoid calling connection lost callbacks when loop is already closed in asyncio subprocess (GH-134508)
(cherry picked from commit 5804ee7b467d86131be3ff7d569443efb0d0f9fd)

Co-authored-by: Kumar Aditya <kumaraditya@python.org>
2025-05-23 04:56:14 +00:00
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)
fd0bba67c4
[3.13] gh-86513: improve docs of loop.call_exception_handler (GH-132466) (#132487)
gh-86513: improve docs of loop.call_exception_handler (GH-132466)
(cherry picked from commit ce753517a87eec776c176f3245ce5d1554a59341)

Co-authored-by: Kumar Aditya <kumaraditya@python.org>
2025-04-14 11:42:45 +00:00
Miss Islington (bot)
8f6a9aa6ae
[3.13] gh-128231: Use runcode() return value for failing early (GH-129488) (#130513)
gh-128231: Use `runcode()` return value for failing early (GH-129488)
(cherry picked from commit 7ed3dc6392613832f66c63507385b1da109cbf21)

Co-authored-by: Bartosz Sławecki <bartoszpiotrslawecki@gmail.com>
2025-03-28 13:11:45 +02:00
Miss Islington (bot)
9a43485830
[3.13] gh-131325: fix sendfile fallback implementation to drain data after writing to transport (GH-131376) (#131377)
gh-131325: fix sendfile fallback implementation to drain data after writing to transport (GH-131376)
(cherry picked from commit 94f4d87aeb4d2d7bddcb4c3aad4f62a727ac91ee)

Co-authored-by: Kumar Aditya <kumaraditya@python.org>
2025-03-17 19:46:30 +00:00
Miss Islington (bot)
1a7b8c0f4d
[3.13] gh-130145: fix loop.run_forever when loop is already running (GH-130146) (#130147)
gh-130145: fix `loop.run_forever` when loop is already running (GH-130146)
(cherry picked from commit a545749b0e6c56cab853c5c8df3c199b9707994f)

Co-authored-by: Kumar Aditya <kumaraditya@python.org>
2025-02-15 09:55:08 +00:00
Andrew Svetlov
7b0543ebe6
[3.13] gh-128308: pass **kwargs to asyncio task_factory (GH-128768) (#130084)
* [3.13] gh-128308: pass `**kwargs` to asyncio task_factory (GH-128768)
(cherry picked from commit 38a99568763604ccec5d5027f0658100ad76876f)

Co-authored-by: Thomas Grainger <tagrain@gmail.com>
Co-authored-by: Kumar Aditya <kumaraditya@python.org>


---------

Co-authored-by: Thomas Grainger <tagrain@gmail.com>
Co-authored-by: Kumar Aditya <kumaraditya@python.org>
2025-02-14 22:04:17 +05:30
Miss Islington (bot)
e9febe51af
[3.13] gh-115514: Fix incomplete writes after close while using ssl in asyncio(GH-128037) (#129581)
gh-115514: Fix incomplete writes after close while using ssl in asyncio(GH-128037)

(cherry picked from commit 4e38eeafe2ff3bfc686514731d6281fed34a435e)

Co-authored-by: Vojtěch Boček <vbocek@gmail.com>
Co-authored-by: Kumar Aditya <kumaraditya@python.org>
2025-02-02 16:12:12 +00:00
Miss Islington (bot)
ad4a141a6b
[3.13] gh-129403: Fix ValueError messages in asyncio.Barrier and threading.Barrier (GH-129419) (#129468)
gh-129403: Fix `ValueError` messages in `asyncio.Barrier` and `threading.Barrier` (GH-129419)
(cherry picked from commit bcb25d60b1baf9348e73cbd2359342cea6009c36)

Co-authored-by: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com>
Co-authored-by: Peter Bierma <zintensitydev@gmail.com>
2025-01-30 09:33:30 +00:00
Miss Islington (bot)
75ec6caa48
[3.13] gh-128479: fix asyncio staggered race leaking tasks, and logging unhandled exception.append exception (GH-128475) (#129227)
gh-128479: fix asyncio staggered race leaking tasks, and logging unhandled exception.append exception (GH-128475)
(cherry picked from commit ec91e1c2762412f1408b0dfb5d281873b852affe)

Co-authored-by: Thomas Grainger <tagrain@gmail.com>
Co-authored-by: Peter Bierma <zintensitydev@gmail.com>
2025-01-23 22:16:02 +01:00
Miss Islington (bot)
a1c48a750c
[3.13] gh-128588: gh-128550: remove eager tasks optimization that missed and introduced incorrect cancellations (GH-129063) (#129089)
gh-128588: gh-128550: remove eager tasks optimization that missed and introduced incorrect cancellations (GH-129063)
(cherry picked from commit ed6934e71e55d398df8263f4697f58e4a3815f69)

Co-authored-by: Thomas Grainger <tagrain@gmail.com>
Co-authored-by: Kumar Aditya <kumaraditya@python.org>
2025-01-20 17:36:50 +00:00
Miss Islington (bot)
d8a442637b
[3.13] gh-128916: Do not set SO_REUSEPORT on non-AF_INET* sockets (GH-128933) (#128969)
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 3829104ab412a47bf3f36b8c133c886d2cc9a6d4)

Co-authored-by: Michał Górny <mgorny@gentoo.org>
Co-authored-by: Vinay Sajip <vinay_sajip@yahoo.co.uk>
2025-01-18 03:45:42 +00:00
Thomas Grainger
13835888e6
[3.13] gh-128552: fix refcycles in eager task creation (#128553) (#128585)
gh-128552: fix refcycles in eager task creation (#128553)

(cherry picked from commit 61b9811ac6843e22b5896ef96030d421b79cd892)
2025-01-08 18:16:43 +05:30
Miss Islington (bot)
aea2e03b27
[3.13] Mention loop_factory argument in docstring for asyncio.run() (GH-128288) (#128291)
Mention loop_factory argument in docstring for asyncio.run() (GH-128288)
(cherry picked from commit 0b5f1fae573a2c658eb000433ad7b87e9c40c697)

Co-authored-by: Andrew Svetlov <andrew.svetlov@gmail.com>
2024-12-27 14:22:25 +00:00
Miss Islington (bot)
71e8429ac8
[3.13] gh-127655: Ensure _SelectorSocketTransport.writelines pauses the protocol if needed (GH-127656) (#127663)
gh-127655: Ensure `_SelectorSocketTransport.writelines` pauses the protocol if needed (GH-127656)

Ensure `_SelectorSocketTransport.writelines` pauses the protocol if it reaches the high water mark as needed.
(cherry picked from commit e991ac8f2037d78140e417cc9a9486223eb3e786)

Co-authored-by: J. Nick Koston <nick@koston.org>
Co-authored-by: Kumar Aditya <kumaraditya@python.org>
2024-12-06 10:42:23 +05:30
Miss Islington (bot)
95bcbcb7c8
[3.13] gh-118950: Fix SSLProtocol.connection_lost not being called when OSError is thrown (GH-118960) (#125931)
gh-118950: Fix SSLProtocol.connection_lost not being called when OSError is thrown (GH-118960)

(cherry picked from commit 3f24bde0b6689b8f05872a8118a97908b5a94659)

Co-authored-by: Javad Shafique <javadshafique@hotmail.com>
Co-authored-by: Kumar Aditya <kumaraditya@python.org>
2024-10-26 22:01:47 +05:30
Miss Islington (bot)
e596740399
[3.13] gh-124858: fix happy eyeballs refcyles (GH-124859) (#124912)
gh-124858: fix happy eyeballs refcyles (GH-124859)
(cherry picked from commit c066bf553577d1000e208eb078d9e758c3e41186)

Co-authored-by: Thomas Grainger <tagrain@gmail.com>
2024-10-23 12:35:56 -07:00
Miss Islington (bot)
35d9624109
[3.13] gh-124594: Create and reuse the same context for the entire asyncio REPL session (GH-124595) (#124848)
gh-124594: Create and reuse the same context for the entire asyncio REPL session (GH-124595)
(cherry picked from commit 67e01a430f4ecfcb540d6a29b347966ff4e53454)

Co-authored-by: Bartosz Sławecki <bartoszpiotrslawecki@gmail.com>
Co-authored-by: Andrew Svetlov <andrew.svetlov@gmail.com>
2024-10-15 13:37:59 +02:00
Miss Islington (bot)
4e08c98292
[3.13] gh-124958: fix asyncio.TaskGroup and _PyFuture refcycles (GH-124959) (#125463)
gh-124958: fix asyncio.TaskGroup and _PyFuture refcycles (GH-124959)
(cherry picked from commit d5dbbf4372cd3dbf3eead1cc70ddc4261c061fd9)

Co-authored-by: Thomas Grainger <tagrain@gmail.com>
2024-10-14 15:45:49 +00:00
Miss Islington (bot)
b4c504d76f
[3.13] gh-124309: fix staggered race on eager tasks (GH-124847) (#125339)
Co-authored-by: Thomas Grainger <tagrain@gmail.com>
Co-authored-by: Peter Bierma <zintensitydev@gmail.com>
2024-10-11 20:11:53 -07:00
Miss Islington (bot)
5c3078d6e5
[3.13] gh-120221: Support KeyboardInterrupt in asyncio REPL (GH-123795) (#123799)
This switches the main pyrepl event loop to always be non-blocking so that it
can listen to incoming interruptions from other threads.

This also resolves invalid display of exceptions from other threads
(gh-123178).

This also fixes freezes with pasting and an active input hook.
(cherry picked from commit 033510e11dff742d9626b9fd895925ac77f566f1)

Co-authored-by: Łukasz Langa <lukasz@langa.pl>
2024-09-06 22:25:19 +02:00
Miss Islington (bot)
d1af4f5372
[3.13] gh-121913: Use str(exc) instead of exc.strerror in asyncio.base_events (GH-122269) (#122278)
gh-121913: Use str(exc) instead of exc.strerror in `asyncio.base_events` (GH-122269)
(cherry picked from commit 070f1e2e5b9b31ee3e7a1af2e30d7e3a66040b17)

Co-authored-by: AN Long <aisk@users.noreply.github.com>
2024-07-25 12:20:40 +00:00
Miss Islington (bot)
148beb6de9
[3.13] gh-121957: Emit audit events for python -i and python -m asyncio (GH-121958) (GH-122115)
Relatedly, emit the `cpython.run_startup` event from the Python version of
`PYTHONSTARTUP` handling.
(cherry picked from commit dc93d1125f594ac7aece98558eaf33d09c348519)

Co-authored-by: Łukasz Langa <lukasz@langa.pl>
2024-07-22 13:36:57 +02:00
Miss Islington (bot)
5b718e7fc7
[3.13] gh-121790: Fix interactive console initialization (GH-121793) (GH-121822)
(cherry picked from commit e5c7216f376a06d2c931daf999e2980e494e747e)

Co-authored-by: Milan Oberkirch <milan.oberkirch@geops.com>
Co-authored-by: Łukasz Langa <lukasz@langa.pl>
2024-07-16 00:49:41 +02:00
Miss Islington (bot)
f0c29a2d9f
[3.13] gh-121711: Set -m asyncio return_code to 1 for ENOTTY (GH-121714) (GH-121718)
Set return_code to 1 for ENOTTY
(cherry picked from commit a1834742936a3a2164c25c14ecf4ae6a95288ca3)

Co-authored-by: Milan Oberkirch <milan.oberkirch@geops.com>
2024-07-13 18:24:52 +02:00
Miss Islington (bot)
c2ad5fd1d1
[3.13] gh-119909: Fix `NameError in asyncio` REPL (GH-121341) (#121447)
gh-119909: Fix ``NameError`` in ``asyncio`` REPL (GH-121341)
(cherry picked from commit 114389470ec3db457c589b3991b695258d23ce5a)

Co-authored-by: Kirill Podoprigora <kirill.bast9@mail.ru>
2024-07-07 01:02:33 +02:00
Miss Islington (bot)
d481d4b767
[3.13] gh-87744: fix waitpid race while calling send_signal in asyncio (GH-121126) (#121194)
gh-87744: fix waitpid race while calling send_signal in asyncio (GH-121126)

asyncio earlier relied on subprocess module to send signals to the process, this has some drawbacks one being that subprocess module unnecessarily calls waitpid on child processes and hence it races with asyncio implementation which internally uses child watchers. To mitigate this, now asyncio sends signals directly to the process without going through the subprocess on non windows systems. On Windows it fallbacks to subprocess module handling but on windows there are no child watchers so this issue doesn't exists altogether.

(cherry picked from commit bd473aa598c5161521a7018896dc124728214a6c)

Co-authored-by: Kumar Aditya <kumaraditya@python.org>
2024-07-01 05:11:47 +00:00
Miss Islington (bot)
0ea77d49cc
[3.13] gh-113892: Add a extra check to ProactorEventLoop.sock_connect to ensure that the given socket is in non-blocking mode (GH-119519) (#119912)
(cherry picked from commit cf3bba3f0671d2c9fee099e3ab0f78b98b176131)

Co-authored-by: Kirill Podoprigora <kirill.bast9@mail.ru>
2024-06-01 16:27:54 +00:00
Miss Islington (bot)
a5272e63ef
[3.13] gh-118894: Make asyncio REPL use pyrepl (GH-119433) (#119884)
(cherry picked from commit 2237946af0981c46dc7d3886477e425ccfb37f28)

Co-authored-by: Łukasz Langa <lukasz@langa.pl>
2024-05-31 17:15:44 -04:00
Miss Islington (bot)
3a8ab99bf7
[3.13] gh-119121: Fix and test async.staggered.staggered_race (GH-119173) (#119206)
gh-119121: Fix and test `async.staggered.staggered_race` (GH-119173)
(cherry picked from commit 16b46ebd2b0025aa461fdfc95fbf98a4f04b49e6)

Co-authored-by: Nikita Sobolev <mail@sobolevn.me>
2024-05-20 11:31:31 +00:00
Miss Islington (bot)
738877a101
[3.13] gh-118817: Fix asyncio REPL on Windows (GH-118819) (#118847)
(cherry picked from commit c3643a121401d111bebd3e26d6f362ade2ed2a83)

Co-authored-by: Kirill Podoprigora <kirill.bast9@mail.ru>
2024-05-09 15:47:31 +00:00
Bruce Merry
01a51f9494
gh-117722: Fix Stream.readuntil with non-bytes buffer objects (#117723)
gh-16429 introduced support for an iterable of separators in
Stream.readuntil. Since bytes-like types are themselves iterable, this
can introduce ambiguities in deciding whether the argument is an
iterator of separators or a singleton separator. In gh-16429, only 'bytes'
was considered a singleton, but this will break code that passes other
buffer object types.

Fix it by only supporting tuples rather than arbitrary iterables.

Closes gh-117722.
2024-04-11 07:41:55 -07:00
Guido van Rossum
fa58e75a86
gh-116720: Fix corner cases of taskgroups (#117407)
This prevents external cancellations of a task group's parent task to
be dropped when an internal cancellation happens at the same time.
Also strengthen the semantics of uncancel() to clear self._must_cancel
when the cancellation count reaches zero.

Co-Authored-By: Tin Tvrtković <tinchester@gmail.com>
Co-Authored-By: Arthur Tacca
2024-04-09 08:17:28 -07:00