Commit Graph

920 Commits

Author SHA1 Message Date
Miss Islington (bot) 1afc0a9591
[3.11] gh-98539: Make _SSLTransportProtocol.abort() safe to call when closed (GH-104474) (#104485)
(cherry picked from commit fb8739f0b6)

Co-authored-by: Sam Bull <git@sambull.org>
2023-05-14 21:24:07 +00:00
Miss Islington (bot) 2cd1b9c2ca
[3.11] gh-103607: Fix `pause_reading` to work when called from `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 78942ecd9b)

Co-authored-by: Itayazolay <itayazolay@gmail.com>
Co-authored-by: Kumar Aditya <59607654+kumaraditya303@users.noreply.github.com>
2023-04-27 10:29:54 +00:00
Miss Islington (bot) a9ece4a839
gh-102780: Fix uncancel() call in asyncio timeouts (GH-102815)
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 04adf2df39)

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>
2023-03-22 11:23:47 -07:00
Miss Islington (bot) 98833563e2
gh-102810: Add docstrings to the public-facing methods of `asyncio.Timeout` (GH-102811)
(cherry picked from commit 699cb20ae6)

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>
2023-03-19 13:31:22 -07:00
Miss Islington (bot) 7e5ba351e0
gh-102560 Add docstrings to asyncio.TaskGroup (GH-102565)
(cherry picked from commit e94edab727)

Co-authored-by: JosephSBoyle <48555120+JosephSBoyle@users.noreply.github.com>
2023-03-15 00:27:33 -07:00
Miss Islington (bot) 42d0ca92ed
[3.11] gh-100226: Clarify StreamReader.read behavior (GH-101807) (#102001)
gh-100226: Clarify StreamReader.read behavior (GH-101807)
(cherry picked from commit 77d95c8373)

Co-authored-by: Jan Gosmann <jan@hyper-world.de>
Co-authored-by: Shantanu <12621235+hauntsaninja@users.noreply.github.com>
2023-02-23 19:05:59 +05:30
Miss Islington (bot) 99da75e770
gh-101143: Remove references to `TimerHandle` from `asyncio.base_events.BaseEventLoop._add_callback` (GH-101197)
(cherry picked from commit 9e947675ae)

Co-authored-by: J. Nick Koston <nick@koston.org>
Co-authored-by: Kumar Aditya <59607654+kumaraditya303@users.noreply.github.com>
2023-01-21 02:28:09 -08:00
Miss Islington (bot) d06315a6fa
[3.11] GH-100573: Fix server hang caused by os.stat() on named pipe (Windows) (GH-100959) (#101019)
(cherry picked from commit 1bc7a73683)
2023-01-13 13:58:20 -08:00
Serhiy Storchaka 1b2459dc64
[3.11] gh-100160: Remove any deprecation warnings in 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>
2023-01-10 12:20:09 -08:00
Miss Islington (bot) ad40764f5b
GH-86508: skip binding to local addresses of different family in `asyncio.open_connection` (GH-100615)
(cherry picked from commit ba8dcdbcab)

Co-authored-by: Kumar Aditya <59607654+kumaraditya303@users.noreply.github.com>
2023-01-04 00:28:00 -08:00
Miss Islington (bot) ae8520c709
GH-100133: fix `asyncio` subprocess losing `stderr` and `stdout` output (GH-100154)
(cherry picked from commit a7715ccfba)

Co-authored-by: Kumar Aditya <59607654+kumaraditya303@users.noreply.github.com>
2022-12-21 02:24:19 -08:00
Serhiy Storchaka 3fae04b10e
[3.11] gh-93453: Only emit deprecation warning in asyncio.get_event_loop 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>
2022-12-06 16:15:44 +01:00
Dong Uk, Kang 24fad64cef
[3.11] gh-88863: Clear ref cycles to resolve leak when 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 995f6170c7)

Co-authored-by: Dong Uk, Kang <nailbrainz@gmail.com>
2022-11-23 10:37:24 -08:00
Miss Islington (bot) 0dfbb769df
[3.11] gh-99277: remove older version of `get_write_buffer_limits` (GH-99280) (#99338)
(cherry picked from commit f1680c3fbf)

Co-authored-by: Carlo <34414634+csuriano23@users.noreply.github.com>
Co-authored-by: Kumar Aditya <59607654+kumaraditya303@users.noreply.github.com>
2022-11-10 09:01:14 -08:00
Miss Islington (bot) 08ce791f94
gh-98703: Fix asyncio proactor_events calling _call_connection_lost multiple times (GH-98704)
Co-authored-by: Kumar Aditya <59607654+kumaraditya303@users.noreply.github.com>
(cherry picked from commit 8a755423eb)

Co-authored-by: Ken Jin <kenjin@python.org>
2022-10-26 20:04:43 -07:00
Miss Islington (bot) 8950689dce
[3.11] GH-89237: fix hang in proactor `subprocess.wait_closed()` (GH-98572) (#98620)
GH-89237: fix hang in proactor `subprocess.wait_closed()` (GH-98572)
(cherry picked from commit ad1dc3ebb6)

Co-authored-by: Kumar Aditya <59607654+kumaraditya303@users.noreply.github.com>
2022-10-24 20:34:08 -07:00
Miss Islington (bot) 36d25a4f7f
[3.11] GH-98543: Fix `asyncio.TaskGroup` to not keep reference to errors 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 f4a14941e6)

Co-authored-by: Kumar Aditya <59607654+kumaraditya303@users.noreply.github.com>
2022-10-24 11:08:22 -07:00
Miss Islington (bot) bd8b32b519
[3.11] GH-98539: fix ref cycle in `_SSLProtocolTransport` after close (GH-98540) (#98551)
GH-98539: fix ref cycle in `_SSLProtocolTransport` after close  (GH-98540)
(cherry picked from commit 62bf5d8d0a)

Co-authored-by: Kumar Aditya <59607654+kumaraditya303@users.noreply.github.com>
2022-10-24 09:26:32 -07:00
Miss Islington (bot) 595ef03c7c
bpo-46364: Use sockets for stdin of asyncio only on AIX (GH-30596)
Signed-off-by: Christoph Hamsen <hamsen.christoph@posteo.de>
Co-authored-by: July Tikhonov <july.tikh@gmail.com>
(cherry picked from commit c9ed0327a9)

Co-authored-by: Christoph Hamsen <37963496+xopham@users.noreply.github.com>
2022-10-13 10:27:31 -07:00
Miss Islington (bot) d163d5976d
GH-90985: Revert "Deprecate passing a message into cancel()" (GH-97999)
Reason: we were too hasty in deprecating this.
We shouldn't deprecate it before we have a replacement.
(cherry picked from commit 09de8d7aaf)

Co-authored-by: Guido van Rossum <guido@python.org>
2022-10-06 18:50:25 -07:00
Miss Islington (bot) bd3dcb3549
[3.11] GH-88050: fix race in closing subprocess pipe in asyncio (GH-97951) (#97978)
Check for None when iterating over `self._pipes.values()`.
(cherry picked from commit e2e6b95c03)

Co-authored-by: Kumar Aditya <59607654+kumaraditya303@users.noreply.github.com>
2022-10-06 12:09:50 -07:00
Miss Islington (bot) aec133347e
gh-88050: Fix asyncio subprocess to kill process cleanly when process is blocked (GH-32073)
(cherry picked from commit 7015e13797)

Co-authored-by: Kumar Aditya <59607654+kumaraditya303@users.noreply.github.com>
2022-10-05 10:48:48 -07:00
Miss Islington (bot) 4420da0aef
gh-94732: Fix KeyboardInterrupt race in asyncio run_forever() (GH-97765)
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 3a49dbb98c)

Co-authored-by: hetmankp <728670+hetmankp@users.noreply.github.com>
2022-10-03 14:39:24 -07:00
Miss Islington (bot) 3614bbb8eb
gh-90908: Document asyncio.Task.cancelling() and asyncio.Task.uncancel() (GH-95253)
Co-authored-by: Thomas Grainger <tagrain@gmail.com>
(cherry picked from commit f00645d5db)

Co-authored-by: Łukasz Langa <lukasz@langa.pl>
2022-10-01 11:10:04 -07:00
Miss Islington (bot) 95609525de
GH-96827: Don't touch closed loops from executor threads (GH-96837)
* When chaining futures, skip callback if loop closed.
* When shutting down an executor, don't wake a closed loop.
(cherry picked from commit e9d63760fe)

Co-authored-by: Guido van Rossum <guido@python.org>
2022-09-30 13:23:33 -07:00
Miss Islington (bot) 9a9bf88898
gh-97545: Make Semaphore run faster. (GH-97549)
(cherry picked from commit 68c46ae68b)

Co-authored-by: Cyker Way <cykerway@gmail.com>
2022-09-26 17:00:53 -07:00
Miss Islington (bot) 6642d8a0f9
GH-85760: Fix race in calling process_exited callback too early (GH-97009)
(cherry picked from commit 282edd7b2a)

Co-authored-by: Kumar Aditya <59607654+kumaraditya303@users.noreply.github.com>
2022-09-22 10:24:54 -07:00
Miss Islington (bot) 773dbb9e3a
gh-90155: Fix bug in asyncio.Semaphore and strengthen FIFO guarantee (GH-93222)
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 24e0379624)

Co-authored-by: Cyker Way <cykerway@gmail.com>
2022-09-22 09:58:35 -07:00
Miss Islington (bot) 335bd1ee8b
gh-94972: document that shield users need to keep a reference to their task (GH-96724)
Co-authored-by: Thomas Grainger <tagrain@gmail.com>
Co-authored-by: Guido van Rossum <gvanrossum@gmail.com>
(cherry picked from commit 6281affee6)

Co-authored-by: Hendrik Makait <hendrik.makait@gmail.com>
2022-09-10 08:03:35 -07:00
Miss Islington (bot) 2e9f29e6a6
GH-74116: Allow multiple drain waiters for asyncio.StreamWriter (GH-94705) (#96395)
(cherry picked from commit e5b2453e61)

Co-authored-by: Kumar Aditya <59607654+kumaraditya303@users.noreply.github.com>

Co-authored-by: Kumar Aditya <59607654+kumaraditya303@users.noreply.github.com>
2022-08-30 12:00:21 +01:00
Miss Islington (bot) 126ec34558
gh-90467: StreamReaderProtocol - add strong reference to created task (GH-96323) (#96344)
(cherry picked from commit e860e521ec)

Co-authored-by: Kirill <iam@python273.pw>

Co-authored-by: Kirill <iam@python273.pw>
2022-08-30 11:59:32 +01:00
Miss Islington (bot) 36c114ab11
GH-95704: Don't suppress errors from tasks when TG is cancelled (GH-95761)
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 f51f54f39d)

Co-authored-by: Guido van Rossum <guido@python.org>
2022-08-17 10:04:59 -07:00
Miss Islington (bot) 8bd7a0b581
GH-95899: fix asyncio.Runner to call set_event_loop only once (GH-95900) (#96003)
(cherry picked from commit 914f6367a0)

Co-authored-by: Kumar Aditya <59607654+kumaraditya303@users.noreply.github.com>
2022-08-15 15:01:23 -07:00
Miss Islington (bot) 24dd1429e5
gh-95724: Clarify taskgroups.py license. (GH-95847)
(cherry picked from commit 7da4937748)

Co-authored-by: Yury Selivanov <yury@edgedb.com>
2022-08-11 16:45:30 -07:00
Miss Islington (bot) 5ac3d0f573
gh-91323: Revert "Allow overriding a future compliance check in asyncio.Task (GH-32197)" (GH-95442) (GH-95652)
This reverts commit d4bb38f82b.
(cherry picked from commit 0342c93a6b)

Co-authored-by: Łukasz Langa <lukasz@langa.pl>
2022-08-04 18:07:39 +02:00
Miss Islington (bot) 2d84fe59c0
GH-95289: Always call uncancel() when parent cancellation is requested (GH-95602)
Co-authored-by: Guido van Rossum <guido@python.org>
(cherry picked from commit 2fef27589e)

Co-authored-by: Kumar Aditya <59607654+kumaraditya303@users.noreply.github.com>
2022-08-04 07:50:54 -07:00
Miss Islington (bot) efeda8b4a1
GH-95097: fix `asyncio.run` for tasks without `uncancel` method (GH-95211) (GH-95387)
(cherry picked from commit 54f48844d1)

Co-authored-by: Kumar Aditya <59607654+kumaraditya303@users.noreply.github.com>
Co-authored-by: Thomas Grainger <tagrain@gmail.com>
2022-07-29 14:38:02 +02:00
Miss Islington (bot) 19d953682e
gh-95051: ensure that timeouts scheduled with `asyncio.Timeout` that have already expired are deliverered promptly (GH-95109) (GH-95216)
Co-authored-by: Kumar Aditya <59607654+kumaraditya303@users.noreply.github.com>
(cherry picked from commit 0c6f898005)

Co-authored-by: Thomas Grainger <tagrain@gmail.com>
2022-07-26 12:16:12 +02:00
Miss Islington (bot) 91176d3883
[3.11] bpo-45924: Fix asyncio incorrect traceback when future's exception is raised multiple times (GH-30274) (#94747)
Co-authored-by: Kumar Aditya <59607654+kumaraditya303@users.noreply.github.com>
2022-07-11 14:17:32 +01:00
Miss Islington (bot) 0187b60106
GH-93896: AAlways set event loop in asyncio.run and IsolatedAsyncioTestCase (GH-94593)
(cherry picked from commit 14fea6b4d2)

Co-authored-by: Kumar Aditya <59607654+kumaraditya303@users.noreply.github.com>
2022-07-06 08:48:37 -07:00
Miss Islington (bot) 7fe949e5ea
GH-94398: TaskGroup: Fail create_task() during shutdown (GH-94400) (GH-94463)
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 594c369949)

Co-authored-by: Guido van Rossum <guido@python.org>
2022-06-30 20:02:42 +02:00
Miss Islington (bot) cf63b80bc4
gh-93297: Make asyncio task groups prevent child tasks from being GCed (GH-93299) (#93305)
(cherry picked from commit e6a57678ca)

Co-authored-by: Yury Selivanov <yury@edgedb.com>

Co-authored-by: Yury Selivanov <yury@edgedb.com>
2022-05-27 15:46:57 -07:00
Miss Islington (bot) 36da1a77c6
gh-92841: Fix asyncio's RuntimeError: Event loop is closed (GH-92842)
(cherry picked from commit 33880b4b1c)

Co-authored-by: Oleg Iarygin <oleg@arhadthedev.net>
2022-05-17 15:59:29 -07:00
David Hewitt c7b7f12b86
gh-91880 - fix typo (GH-92069)
https://github.com/python/cpython/issues/91880#issuecomment-1113914241 - With thanks to @MojoVampire for spotting this.

Automerge-Triggered-By: GH:gvanrossum
2022-04-29 22:23:54 -07:00
Alexander Shadchin f882d33778
Fix missing `f` prefix on f-strings (GH-91910) 2022-04-27 09:30:54 +03:00
David Hewitt 1cd8c29dac
gh-91880: add try/except around `signal.signal` (#91881)
Fixes gh-91880.
2022-04-25 08:56:20 -07:00
msoxzw 42fabc3ea7
gh-91487: Optimize asyncio UDP speed (GH-91488)
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
2022-04-15 12:59:01 -07:00
Oleg Iarygin 6217864fe5
gh-79156: Add start_tls() method to streams API (#91453)
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>
2022-04-15 14:23:14 +02:00
Andrew Svetlov d4bb38f82b
bpo-47167: Allow overriding a future compliance check in asyncio.Task (GH-32197) 2022-04-01 04:25:15 +03:00
Andrew Svetlov f08a191882
bpo-39622: Interrupt the main asyncio task on Ctrl+C (GH-32105)
Co-authored-by: Kumar Aditya <59607654+kumaraditya303@users.noreply.github.com>
2022-03-30 15:15:06 +03:00