summaryrefslogtreecommitdiffstats
path: root/Lib/asyncio
Commit message (Collapse)AuthorAgeFilesLines
* [3.13] gh-115514: Fix incomplete writes after close while using ssl in ↵Miss Islington (bot)2025-02-021-5/+7
| | | | | | | | | | 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>
* [3.13] gh-129403: Fix `ValueError` messages in `asyncio.Barrier` and ↵Miss Islington (bot)2025-01-301-1/+1
| | | | | | | | | `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>
* [3.13] gh-128479: fix asyncio staggered race leaking tasks, and logging ↵Miss Islington (bot)2025-01-231-24/+48
| | | | | | | | | 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>
* [3.13] gh-128588: gh-128550: remove eager tasks optimization that missed and ↵Miss Islington (bot)2025-01-201-7/+5
| | | | | | | | | 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>
* [3.13] gh-128916: Do not set `SO_REUSEPORT` on non-`AF_INET*` sockets ↵Miss Islington (bot)2025-01-181-1/+3
| | | | | | | | | | | | | | | | | | | | | (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>
* [3.13] gh-128552: fix refcycles in eager task creation (#128553) (#128585)Thomas Grainger2025-01-082-2/+12
| | | | | gh-128552: fix refcycles in eager task creation (#128553) (cherry picked from commit 61b9811ac6843e22b5896ef96030d421b79cd892)
* [3.13] Mention loop_factory argument in docstring for asyncio.run() ↵Miss Islington (bot)2024-12-271-0/+1
| | | | | | | | (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>
* [3.13] gh-127655: Ensure `_SelectorSocketTransport.writelines` pauses the ↵Miss Islington (bot)2024-12-061-0/+1
| | | | | | | | | | | 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>
* [3.13] gh-118950: Fix SSLProtocol.connection_lost not being called when ↵Miss Islington (bot)2024-10-261-1/+4
| | | | | | | | | | 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>
* [3.13] gh-124858: fix happy eyeballs refcyles (GH-124859) (#124912)Miss Islington (bot)2024-10-232-6/+13
| | | | | | gh-124858: fix happy eyeballs refcyles (GH-124859) (cherry picked from commit c066bf553577d1000e208eb078d9e758c3e41186) Co-authored-by: Thomas Grainger <tagrain@gmail.com>
* [3.13] gh-124594: Create and reuse the same context for the entire asyncio ↵Miss Islington (bot)2024-10-151-2/+4
| | | | | | | | | 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>
* [3.13] gh-124958: fix asyncio.TaskGroup and _PyFuture refcycles (GH-124959) ↵Miss Islington (bot)2024-10-142-13/+34
| | | | | | | | (#125463) gh-124958: fix asyncio.TaskGroup and _PyFuture refcycles (GH-124959) (cherry picked from commit d5dbbf4372cd3dbf3eead1cc70ddc4261c061fd9) Co-authored-by: Thomas Grainger <tagrain@gmail.com>
* [3.13] gh-124309: fix staggered race on eager tasks (GH-124847) (#125339)Miss Islington (bot)2024-10-121-3/+14
| | | | Co-authored-by: Thomas Grainger <tagrain@gmail.com> Co-authored-by: Peter Bierma <zintensitydev@gmail.com>
* [3.13] gh-120221: Support KeyboardInterrupt in asyncio REPL (GH-123795) ↵Miss Islington (bot)2024-09-061-0/+10
| | | | | | | | | | | | | | (#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>
* [3.13] gh-121913: Use str(exc) instead of exc.strerror in ↵Miss Islington (bot)2024-07-251-3/+2
| | | | | | | | `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>
* [3.13] gh-121957: Emit audit events for `python -i` and `python -m asyncio` ↵Miss Islington (bot)2024-07-221-0/+5
| | | | | | | | | (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>
* [3.13] gh-121790: Fix interactive console initialization (GH-121793) (GH-121822)Miss Islington (bot)2024-07-151-18/+9
| | | | | | (cherry picked from commit e5c7216f376a06d2c931daf999e2980e494e747e) Co-authored-by: Milan Oberkirch <milan.oberkirch@geops.com> Co-authored-by: Łukasz Langa <lukasz@langa.pl>
* [3.13] gh-121711: Set `-m asyncio` return_code to 1 for ENOTTY (GH-121714) ↵Miss Islington (bot)2024-07-131-1/+2
| | | | | | | | (GH-121718) Set return_code to 1 for ENOTTY (cherry picked from commit a1834742936a3a2164c25c14ecf4ae6a95288ca3) Co-authored-by: Milan Oberkirch <milan.oberkirch@geops.com>
* [3.13] gh-119909: Fix ``NameError`` in ``asyncio`` REPL (GH-121341) (#121447)Miss Islington (bot)2024-07-061-1/+1
| | | | | | gh-119909: Fix ``NameError`` in ``asyncio`` REPL (GH-121341) (cherry picked from commit 114389470ec3db457c589b3991b695258d23ce5a) Co-authored-by: Kirill Podoprigora <kirill.bast9@mail.ru>
* [3.13] gh-87744: fix waitpid race while calling send_signal in asyncio ↵Miss Islington (bot)2024-07-011-9/+26
| | | | | | | | | | | (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>
* [3.13] gh-113892: Add a extra check to `ProactorEventLoop.sock_connect` to ↵Miss Islington (bot)2024-06-011-0/+2
| | | | | | | 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>
* [3.13] gh-118894: Make asyncio REPL use pyrepl (GH-119433) (#119884)Miss Islington (bot)2024-05-311-18/+71
| | | | | (cherry picked from commit 2237946af0981c46dc7d3886477e425ccfb37f28) Co-authored-by: Łukasz Langa <lukasz@langa.pl>
* [3.13] gh-119121: Fix and test `async.staggered.staggered_race` (GH-119173) ↵Miss Islington (bot)2024-05-201-2/+1
| | | | | | | | (#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>
* [3.13] gh-118817: Fix `asyncio REPL` on Windows (GH-118819) (#118847)Miss Islington (bot)2024-05-091-3/+4
| | | | | (cherry picked from commit c3643a121401d111bebd3e26d6f362ade2ed2a83) Co-authored-by: Kirill Podoprigora <kirill.bast9@mail.ru>
* gh-117722: Fix Stream.readuntil with non-bytes buffer objects (#117723)Bruce Merry2024-04-111-5/+5
| | | | | | | | | | | | | 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.
* gh-116720: Fix corner cases of taskgroups (#117407)Guido van Rossum2024-04-092-6/+15
| | | | | | | | | | 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
* gh-81322: support multiple separators in StreamReader.readuntil (#16429)Bruce Merry2024-04-081-21/+44
|
* gh-96471: Correct documentation for asyncio queue shutdown (#117621)Laurie O2024-04-081-2/+4
|
* gh-96471: Add asyncio queue shutdown (#104228)Laurie O2024-04-061-3/+65
| | | Co-authored-by: Duprat <yduprat@gmail.com>
* gh-117459: Keep the traceback in _convert_future_exc (#117460)rsp4jack2024-04-041-4/+2
|
* gh-77714: Provide an async iterator version of as_completed (GH-22491)Justin Turner Arthur2024-04-011-44/+108
| | | | | | | | | * as_completed returns object that is both iterator and async iterator * Existing tests adjusted to test both the old and new style * New test to ensure iterator can be resumed * New test to ensure async iterator yields any passed-in Futures as-is Co-authored-by: Serhiy Storchaka <storchaka@gmail.com> Co-authored-by: Guido van Rossum <gvanrossum@gmail.com>
* gh-91227: Ignore ERROR_PORT_UNREACHABLE in proactor recvfrom() (#32011)Erik Soma2024-03-231-12/+17
|
* gh-116773: Ensure overlapped objects on Windows are not deallocated too ↵jkriegshauser2024-03-201-7/+7
| | | | early by asyncio (GH-116774)
* gh-113538: Add asycio.Server.{close,abort}_clients (redo) (#116784)Pierre Ossman (ThinLinc team)2024-03-184-12/+31
| | | | | | | These give applications the option of more forcefully terminating client connections for asyncio servers. Useful when terminating a service and there is limited time to wait for clients to finish up their work. This is a do-over with a test fix for gh-114432, which was reverted.
* gh-113538: Revert "gh-113538: Add asycio.Server.{close,abort}_clients ↵Guido van Rossum2024-03-124-31/+12
| | | | | | | | | | (#114432)" (#116632) Revert "gh-113538: Add asycio.Server.{close,abort}_clients (#114432)" Reason: The new test doesn't always pass: https://github.com/python/cpython/pull/116423#issuecomment-1989425489 This reverts commit 1d0d49a7e86257ff95b4de0685e6997d7533993c.
* gh-113538: Add asycio.Server.{close,abort}_clients (#114432)Pierre Ossman (ThinLinc team)2024-03-114-12/+31
| | | | | | These give applications the option of more forcefully terminating client connections for asyncio servers. Useful when terminating a service and there is limited time to wait for clients to finish up their work.
* gh-115957: Close coroutine if TaskGroup.create_task() raises an error (#116009)Jason Zhang2024-03-061-0/+3
|
* chore: fix typos (#116345)cui fliter2024-03-051-1/+1
| | | Signed-off-by: cui fliter <imcusg@gmail.com>
* gh-84995: Run sys.__interactivehook__() on asyncio REPL startup (#20517)Rémi Lapeyre2024-03-011-0/+16
| | | | | | | | | | This makes the asyncio REPL (`python -m asyncio`) more usable and similar to the regular REPL. This exposes register_readline() as a top-level function in site.py, but it's intentionally undocumented. Co-authored-by: Carol Willing <carolcode@willingconsulting.com> Co-authored-by: Itamar Oren <itamarost@gmail.com>
* gh-112997: Don't log arguments in asyncio unless debugging (#115667)Pierre Ossman (ThinLinc team)2024-02-282-9/+19
| | | | | | Nothing else in Python generally logs the contents of variables, so this can be very unexpected for developers and could leak sensitive information in to terminals and log files.
* gh-114914: Avoid keeping dead StreamWriter alive (#115661)Pierre Ossman (ThinLinc team)2024-02-281-10/+4
| | | | | | | | | | In some cases we might cause a StreamWriter to stay alive even when the application has dropped all references to it. This prevents us from doing automatical cleanup, and complaining that the StreamWriter wasn't properly closed. Fortunately, the extra reference was never actually used for anything so we can just drop it.
* gh-111358: Fix timeout behaviour in BaseEventLoop.shutdown_default_executor ↵Jamie Phan2024-02-191-9/+11
| | | | (#115622)
* gh-113812: Allow DatagramTransport.sendto to send empty data (#115199)Jamie Phan2024-02-173-7/+4
| | | | Also include the UDP packet header sizes (8 bytes per packet) in the buffer size reported to the flow control subsystem.
* gh-114887 Reject only sockets of type SOCK_STREAM in ↵Travis Howse2024-02-031-2/+2
| | | | | | | create_datagram_endpoint() (#114893) Also improve exception message. Co-authored-by: Donghee Na <donghee.na92@gmail.com>
* gh-112202: Ensure that condition.notify() succeeds even when racing with ↵Kristján Valur Jónsson2024-02-031-49/+63
| | | | | Task.cancel() (#112201) Also did a general cleanup of asyncio locks.py comments and docstrings.
* gh-109534: fix reference leak when SSL handshake fails (#114074)Jamie Phan2024-02-012-0/+5
|
* TaskGroup: Use explicit None check for cancellation error (#114708)Matan Perelman2024-01-291-1/+1
|
* gh-75128: Ignore EADDRNOTAVAIL error in ↵Serhiy Storchaka2024-01-221-3/+17
| | | | | asyncio.BaseEventLoop.create_server() (GH-114420) Co-authored-by: Antoine Pitrou <pitrou@free.fr>
* gh-114281: Remove incorrect type hints from `asyncio.staggered` (#114282)Nikita Sobolev2024-01-201-11/+1
| | | Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
* gh-95649: Document that asyncio contains uvloop code (#107536)Alois Klink2024-01-123-0/+12
| | | | | | | | Some of the asyncio SSL changes in GH-31275 [1] were taken from v0.16.0 of the uvloop project [2]. In order to comply with the MIT license, we need to just need to document the copyright information. [1]: https://github.com/python/cpython/pull/31275 [2]: https://github.com/MagicStack/uvloop/tree/v0.16.0