summaryrefslogtreecommitdiffstats
path: root/Lib/asyncio
Commit message (Collapse)AuthorAgeFilesLines
* [3.11] gh-104340: Suppress warning about unawaited exception for closed pipe ↵Miss Islington (bot)2023-05-181-0/+3
| | | | | | | stdin (GH-104586) (#104594) (cherry picked from commit 7fc8e2d4627cdba5cb0075c9052ed6f4b6ecd36d) Co-authored-by: Guido van Rossum <guido@python.org>
* [3.11] gh-98539: Make _SSLTransportProtocol.abort() safe to call when closed ↵Miss Islington (bot)2023-05-141-1/+2
| | | | | | | (GH-104474) (#104485) (cherry picked from commit fb8739f0b6291fb048a94d6312f59ba4d10a20ca) Co-authored-by: Sam Bull <git@sambull.org>
* [3.11] gh-103607: Fix `pause_reading` to work when called from ↵Miss Islington (bot)2023-04-272-24/+32
| | | | | | | | | `connection_made` in `asyncio`. (GH-17425) (#103918) gh-103607: Fix `pause_reading` to work when called from `connection_made` in `asyncio`. (GH-17425) (cherry picked from commit 78942ecd9b1dbbd95e99cc298b0154fe126dac12) Co-authored-by: Itayazolay <itayazolay@gmail.com> Co-authored-by: Kumar Aditya <59607654+kumaraditya303@users.noreply.github.com>
* gh-102780: Fix uncancel() call in asyncio timeouts (GH-102815)Miss Islington (bot)2023-03-221-3/+4
| | | | | | | | | | Also use `raise TimeOut from <CancelledError instance>` so that the CancelledError is set in the `__cause__` field rather than in the `__context__` field. (cherry picked from commit 04adf2df395ded81922c71360a5d66b597471e49) Co-authored-by: Kristján Valur Jónsson <sweskman@gmail.com> Co-authored-by: Guido van Rossum <gvanrossum@gmail.com> Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
* gh-102810: Add docstrings to the public-facing methods of `asyncio.Timeout` ↵Miss Islington (bot)2023-03-191-0/+12
| | | | | | | | | (GH-102811) (cherry picked from commit 699cb20ae6fdef8b0f13d633cf4858465ef3469f) Co-authored-by: JosephSBoyle <48555120+JosephSBoyle@users.noreply.github.com> Co-authored-by: Guido van Rossum <gvanrossum@gmail.com> Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
* gh-102560 Add docstrings to asyncio.TaskGroup (GH-102565)Miss Islington (bot)2023-03-151-0/+18
| | | | | (cherry picked from commit e94edab727d07bef851e0e1a345e18a453be863d) Co-authored-by: JosephSBoyle <48555120+JosephSBoyle@users.noreply.github.com>
* [3.11] gh-100226: Clarify StreamReader.read behavior (GH-101807) (#102001)Miss Islington (bot)2023-02-231-8/+9
| | | | | | | gh-100226: Clarify StreamReader.read behavior (GH-101807) (cherry picked from commit 77d95c83733722ada35eb1ef89ae5b84a51ddd32) Co-authored-by: Jan Gosmann <jan@hyper-world.de> Co-authored-by: Shantanu <12621235+hauntsaninja@users.noreply.github.com>
* gh-101143: Remove references to `TimerHandle` from ↵Miss Islington (bot)2023-01-211-6/+3
| | | | | | | | `asyncio.base_events.BaseEventLoop._add_callback` (GH-101197) (cherry picked from commit 9e947675ae3dc32f5863e5ed3022301cf7fd79b4) Co-authored-by: J. Nick Koston <nick@koston.org> Co-authored-by: Kumar Aditya <59607654+kumaraditya303@users.noreply.github.com>
* [3.11] GH-100573: Fix server hang caused by os.stat() on named pipe ↵Miss Islington (bot)2023-01-131-0/+5
| | | | | | (Windows) (GH-100959) (#101019) (cherry picked from commit 1bc7a736837272b15ad3a7aa472977bc720d1033)
* [3.11] gh-100160: Remove any deprecation warnings in ↵Serhiy Storchaka2023-01-101-15/+0
| | | | | | | asyncio.get_event_loop() (#100412) Some deprecation warnings will reappear (in a slightly different form) in 3.12. Co-authored-by: Guido van Rossum <guido@python.org>
* GH-86508: skip binding to local addresses of different family in ↵Miss Islington (bot)2023-01-041-2/+8
| | | | | | | `asyncio.open_connection` (GH-100615) (cherry picked from commit ba8dcdbcab5fd9989be6c9a51002394e782c463c) Co-authored-by: Kumar Aditya <59607654+kumaraditya303@users.noreply.github.com>
* GH-100133: fix `asyncio` subprocess losing `stderr` and `stdout` output ↵Miss Islington (bot)2022-12-211-3/+0
| | | | | | | (GH-100154) (cherry picked from commit a7715ccfba5b86ab09f86ec56ac3755c93b46b48) Co-authored-by: Kumar Aditya <59607654+kumaraditya303@users.noreply.github.com>
* [3.11] gh-93453: Only emit deprecation warning in asyncio.get_event_loop ↵Serhiy Storchaka2022-12-061-3/+19
| | | | | | | when a new event loop is created (#99949) It no longer emits a deprecation warning if the current event loop was set. Co-authored-by: Łukasz Langa <lukasz@langa.pl>
* [3.11] gh-88863: Clear ref cycles to resolve leak when ↵Dong Uk, Kang2022-11-233-12/+33
| | | | | | | | | asyncio.open_connection raises (GH-95739) (#99721) Break reference cycles to resolve memory leak, by removing local exception and future instances from the frame. (cherry picked from commit 995f6170c78570eca818f7e7dbd8a7661c171a81) Co-authored-by: Dong Uk, Kang <nailbrainz@gmail.com>
* [3.11] gh-99277: remove older version of `get_write_buffer_limits` ↵Miss Islington (bot)2022-11-101-6/+0
| | | | | | | | | (GH-99280) (#99338) (cherry picked from commit f1680c3fbf7d18a1b3a5b390c433298bb6b9fcac) Co-authored-by: Carlo <34414634+csuriano23@users.noreply.github.com> Co-authored-by: Kumar Aditya <59607654+kumaraditya303@users.noreply.github.com>
* gh-98703: Fix asyncio proactor_events calling _call_connection_lost multiple ↵Miss Islington (bot)2022-10-271-0/+2
| | | | | | | | times (GH-98704) Co-authored-by: Kumar Aditya <59607654+kumaraditya303@users.noreply.github.com> (cherry picked from commit 8a755423eba8e19704d96905730cf7f50083eb23) Co-authored-by: Ken Jin <kenjin@python.org>
* [3.11] GH-89237: fix hang in proactor `subprocess.wait_closed()` (GH-98572) ↵Miss Islington (bot)2022-10-251-1/+3
| | | | | | | | | (#98620) GH-89237: fix hang in proactor `subprocess.wait_closed()` (GH-98572) (cherry picked from commit ad1dc3ebb6aadaeeeacde13d4ed2d62bf302bf62) Co-authored-by: Kumar Aditya <59607654+kumaraditya303@users.noreply.github.com>
* [3.11] GH-98543: Fix `asyncio.TaskGroup` to not keep reference to errors ↵Miss Islington (bot)2022-10-241-5/+5
| | | | | | | | after raising ExceptionGroup (GH-98544) (#98550) GH-98543: Fix `asyncio.TaskGroup` to not keep reference to errors after raising ExceptionGroup (GH-98544) (cherry picked from commit f4a14941e6e54b15012fca067f6a9b2ff29f201a) Co-authored-by: Kumar Aditya <59607654+kumaraditya303@users.noreply.github.com>
* [3.11] GH-98539: fix ref cycle in `_SSLProtocolTransport` after close ↵Miss Islington (bot)2022-10-241-2/+5
| | | | | | | | (GH-98540) (#98551) GH-98539: fix ref cycle in `_SSLProtocolTransport` after close (GH-98540) (cherry picked from commit 62bf5d8d0a36112619436a813ceefb7e4af52c24) Co-authored-by: Kumar Aditya <59607654+kumaraditya303@users.noreply.github.com>
* bpo-46364: Use sockets for stdin of asyncio only on AIX (GH-30596)Miss Islington (bot)2022-10-131-4/+3
| | | | | | | Signed-off-by: Christoph Hamsen <hamsen.christoph@posteo.de> Co-authored-by: July Tikhonov <july.tikh@gmail.com> (cherry picked from commit c9ed0327a9c741a1808926b409df29467baf303a) Co-authored-by: Christoph Hamsen <37963496+xopham@users.noreply.github.com>
* GH-90985: Revert "Deprecate passing a message into cancel()" (GH-97999)Miss Islington (bot)2022-10-072-11/+0
| | | | | | | Reason: we were too hasty in deprecating this. We shouldn't deprecate it before we have a replacement. (cherry picked from commit 09de8d7aafece264720afbca3052a63eee413b73) Co-authored-by: Guido van Rossum <guido@python.org>
* [3.11] GH-88050: fix race in closing subprocess pipe in asyncio (GH-97951) ↵Miss Islington (bot)2022-10-061-1/+3
| | | | | | | | (#97978) Check for None when iterating over `self._pipes.values()`. (cherry picked from commit e2e6b95c0342247ed1a761b6e149ac579a8722dd) Co-authored-by: Kumar Aditya <59607654+kumaraditya303@users.noreply.github.com>
* gh-88050: Fix asyncio subprocess to kill process cleanly when process is ↵Miss Islington (bot)2022-10-051-6/+7
| | | | | | | blocked (GH-32073) (cherry picked from commit 7015e1379791cbf19908cd1a7c668a5d6e7165d5) Co-authored-by: Kumar Aditya <59607654+kumaraditya303@users.noreply.github.com>
* gh-94732: Fix KeyboardInterrupt race in asyncio run_forever() (GH-97765)Miss Islington (bot)2022-10-031-3/+4
| | | | | | Ensure that the event loop's `_thread_id` attribute and the asyncgen hooks set by `sys.set_asyncgen_hooks()` are always restored no matter where a KeyboardInterrupt exception is raised. (cherry picked from commit 3a49dbb98ccc1b90554ed181386316efa38adfba) Co-authored-by: hetmankp <728670+hetmankp@users.noreply.github.com>
* gh-90908: Document asyncio.Task.cancelling() and asyncio.Task.uncancel() ↵Miss Islington (bot)2022-10-011-2/+2
| | | | | | | | (GH-95253) Co-authored-by: Thomas Grainger <tagrain@gmail.com> (cherry picked from commit f00645d5dbf4cfa0b8f382c8977724578dff191d) Co-authored-by: Łukasz Langa <lukasz@langa.pl>
* GH-96827: Don't touch closed loops from executor threads (GH-96837)Miss Islington (bot)2022-09-302-2/+6
| | | | | | | * When chaining futures, skip callback if loop closed. * When shutting down an executor, don't wake a closed loop. (cherry picked from commit e9d63760fea8748638f6e495b5b07bd1805c9591) Co-authored-by: Guido van Rossum <guido@python.org>
* gh-97545: Make Semaphore run faster. (GH-97549)Miss Islington (bot)2022-09-271-21/+17
| | | | | (cherry picked from commit 68c46ae68b6e0c36a12e37285fff9ce0782ed01e) Co-authored-by: Cyker Way <cykerway@gmail.com>
* GH-85760: Fix race in calling process_exited callback too early (GH-97009)Miss Islington (bot)2022-09-221-1/+2
| | | | | (cherry picked from commit 282edd7b2a74c4dfe1bfe3c5b1d30f9c21d554d6) Co-authored-by: Kumar Aditya <59607654+kumaraditya303@users.noreply.github.com>
* gh-90155: Fix bug in asyncio.Semaphore and strengthen FIFO guarantee (GH-93222)Miss Islington (bot)2022-09-221-22/+42
| | | | | | | | | | | The main problem was that an unluckily timed task cancellation could cause the semaphore to be stuck. There were also doubts about strict FIFO ordering of tasks allowed to pass. The Semaphore implementation was rewritten to be more similar to Lock. Many tests for edge cases (including cancellation) were added. (cherry picked from commit 24e03796248ab8c7f62d715c28156abe2f1c0d20) Co-authored-by: Cyker Way <cykerway@gmail.com>
* gh-94972: document that shield users need to keep a reference to their task ↵Miss Islington (bot)2022-09-101-2/+9
| | | | | | | | | (GH-96724) Co-authored-by: Thomas Grainger <tagrain@gmail.com> Co-authored-by: Guido van Rossum <gvanrossum@gmail.com> (cherry picked from commit 6281affee6423296893b509cd78dc563ca58b196) Co-authored-by: Hendrik Makait <hendrik.makait@gmail.com>
* GH-74116: Allow multiple drain waiters for asyncio.StreamWriter (GH-94705) ↵Miss Islington (bot)2022-08-301-19/+16
| | | | | | | | | (#96395) (cherry picked from commit e5b2453e61ba5376831093236d598ef5f9f1de61) Co-authored-by: Kumar Aditya <59607654+kumaraditya303@users.noreply.github.com> Co-authored-by: Kumar Aditya <59607654+kumaraditya303@users.noreply.github.com>
* gh-90467: StreamReaderProtocol - add strong reference to created task ↵Miss Islington (bot)2022-08-301-1/+3
| | | | | | | | | (GH-96323) (#96344) (cherry picked from commit e860e521ec0d84e175269aeb15cf24bd6053ad17) Co-authored-by: Kirill <iam@python273.pw> Co-authored-by: Kirill <iam@python273.pw>
* GH-95704: Don't suppress errors from tasks when TG is cancelled (GH-95761)Miss Islington (bot)2022-08-171-4/+3
| | | | | | | | | | | | | | | | When a task catches CancelledError and raises some other error, the other error should not silently be suppressed. Any scenario where a task crashes in cleanup upon cancellation will now result in an ExceptionGroup wrapping the crash(es) instead of propagating CancelledError and ignoring the side errors. NOTE: This represents a change in behavior (hence the need to change several tests). But it is only an edge case. Co-authored-by: Thomas Grainger <tagrain@gmail.com> (cherry picked from commit f51f54f39d384da63be622bcdc9cf4cfb43bad3d) Co-authored-by: Guido van Rossum <guido@python.org>
* GH-95899: fix asyncio.Runner to call set_event_loop only once (GH-95900) ↵Miss Islington (bot)2022-08-151-3/+5
| | | | | | | | (#96003) (cherry picked from commit 914f6367a0d015986dafa7a9d542e24192753b6b) Co-authored-by: Kumar Aditya <59607654+kumaraditya303@users.noreply.github.com>
* gh-95724: Clarify taskgroups.py license. (GH-95847)Miss Islington (bot)2022-08-111-1/+2
| | | | | (cherry picked from commit 7da4937748eb588bb0e977839061ce76cab1b252) Co-authored-by: Yury Selivanov <yury@edgedb.com>
* gh-91323: Revert "Allow overriding a future compliance check in asyncio.Task ↵Miss Islington (bot)2022-08-041-5/+1
| | | | | | | | (GH-32197)" (GH-95442) (GH-95652) This reverts commit d4bb38f82bf18b00db3129031ce4969b6f0caab9. (cherry picked from commit 0342c93a6b866118c894c4e1120fb4db316adebb) Co-authored-by: Łukasz Langa <lukasz@langa.pl>
* GH-95289: Always call uncancel() when parent cancellation is requested ↵Miss Islington (bot)2022-08-041-8/+9
| | | | | | | | (GH-95602) Co-authored-by: Guido van Rossum <guido@python.org> (cherry picked from commit 2fef27589e44c91042c2598b5cad6c6ad0516d93) Co-authored-by: Kumar Aditya <59607654+kumaraditya303@users.noreply.github.com>
* GH-95097: fix `asyncio.run` for tasks without `uncancel` method (GH-95211) ↵Miss Islington (bot)2022-07-291-4/+5
| | | | | | | | (GH-95387) (cherry picked from commit 54f48844d18bc6fb98849f15a2fc08f92ad240ea) Co-authored-by: Kumar Aditya <59607654+kumaraditya303@users.noreply.github.com> Co-authored-by: Thomas Grainger <tagrain@gmail.com>
* gh-95051: ensure that timeouts scheduled with `asyncio.Timeout` that have ↵Miss Islington (bot)2022-07-261-4/+4
| | | | | | | | already expired are deliverered promptly (GH-95109) (GH-95216) Co-authored-by: Kumar Aditya <59607654+kumaraditya303@users.noreply.github.com> (cherry picked from commit 0c6f898005099be189ee65bcfda659f5fc13b802) Co-authored-by: Thomas Grainger <tagrain@gmail.com>
* [3.11] bpo-45924: Fix asyncio incorrect traceback when future's exception is ↵Miss Islington (bot)2022-07-111-1/+2
| | | | | raised multiple times (GH-30274) (#94747) Co-authored-by: Kumar Aditya <59607654+kumaraditya303@users.noreply.github.com>
* GH-93896: AAlways set event loop in asyncio.run and IsolatedAsyncioTestCase ↵Miss Islington (bot)2022-07-061-0/+6
| | | | | | | (GH-94593) (cherry picked from commit 14fea6b4d25658bc00adbb97dd40ea3d3e6843ad) Co-authored-by: Kumar Aditya <59607654+kumaraditya303@users.noreply.github.com>
* GH-94398: TaskGroup: Fail create_task() during shutdown (GH-94400) (GH-94463)Miss Islington (bot)2022-06-301-0/+2
| | | | | | | | | | Once the task group is shutting down, it should not be possible to create a new task. Here "shutting down" means `self._aborting` is set, indicating that at least one task has failed and we have cancelled all others. Co-authored-by: Łukasz Langa <lukasz@langa.pl> (cherry picked from commit 594c3699492bfb007650538726d953cbed55de04) Co-authored-by: Guido van Rossum <guido@python.org>
* gh-93297: Make asyncio task groups prevent child tasks from being GCed ↵Miss Islington (bot)2022-05-271-13/+6
| | | | | | | | | (GH-93299) (#93305) (cherry picked from commit e6a57678cafe18ca132ee9510252168fcc392a8d) Co-authored-by: Yury Selivanov <yury@edgedb.com> Co-authored-by: Yury Selivanov <yury@edgedb.com>
* gh-92841: Fix asyncio's RuntimeError: Event loop is closed (GH-92842)Miss Islington (bot)2022-05-171-1/+1
| | | | | (cherry picked from commit 33880b4b1c60f54aa9e7fa02698a3c82eafe3dc7) Co-authored-by: Oleg Iarygin <oleg@arhadthedev.net>
* gh-91880 - fix typo (GH-92069)David Hewitt2022-04-301-1/+1
| | | | | https://github.com/python/cpython/issues/91880#issuecomment-1113914241 - With thanks to @MojoVampire for spotting this. Automerge-Triggered-By: GH:gvanrossum
* Fix missing `f` prefix on f-strings (GH-91910)Alexander Shadchin2022-04-271-1/+1
|
* gh-91880: add try/except around `signal.signal` (#91881)David Hewitt2022-04-251-1/+7
| | | | Fixes gh-91880.
* gh-91487: Optimize asyncio UDP speed (GH-91488)msoxzw2022-04-152-2/+9
| | | | | | | Fix #91487 When transferring a small file, e.g. 256 KiB, the speed of this PR is comparable. However, if a large file, e.g. 65536 KiB, is transferred, asyncio UDP will be over 100 times faster than the original. The speed is presumably significantly faster if a larger file is transferred, e.g. 1048576 KiB. Automerge-Triggered-By: GH:gpshead
* gh-79156: Add start_tls() method to streams API (#91453)Oleg Iarygin2022-04-151-0/+21
| | | | | | | | | | | | | The existing event loop `start_tls()` method is not sufficient for connections using the streams API. The existing StreamReader works because the new transport passes received data to the original protocol. The StreamWriter must then write data to the new transport, and the StreamReaderProtocol must be updated to close the new transport correctly. The new StreamWriter `start_tls()` updates itself and the reader protocol to the new SSL transport. Co-authored-by: Ian Good <icgood@gmail.com>
* bpo-47167: Allow overriding a future compliance check in asyncio.Task (GH-32197)Andrew Svetlov2022-04-011-1/+5
|