summaryrefslogtreecommitdiffstats
path: root/Lib/asyncio
Commit message (Collapse)AuthorAgeFilesLines
* gh-93297: Make asyncio task groups prevent child tasks from being GCed (#93299)Yury Selivanov2022-05-271-13/+6
|
* gh-92841: Fix asyncio's RuntimeError: Event loop is closed (GH-92842)Oleg Iarygin2022-05-171-1/+1
|
* 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
|
* bpo-39622: Interrupt the main asyncio task on Ctrl+C (GH-32105)Andrew Svetlov2022-03-301-1/+36
| | | Co-authored-by: Kumar Aditya <59607654+kumaraditya303@users.noreply.github.com>
* bpo-27929: resolve names only for AF_INET/AF_INET6 with asyncio (GH-32131)Vincent Bernat2022-03-281-1/+2
| | | Co-authored-by: Andrew Svetlov <andrew.svetlov@gmail.com>
* bpo-47062: Rename factory argument to loop_factory (GH-32113)Andrew Svetlov2022-03-251-5/+5
|
* bpo-43352: Add a Barrier object in asyncio lib (GH-24903)Duprat2022-03-252-3/+161
| | | | Co-authored-by: Yury Selivanov <yury@edgedb.com> Co-authored-by: Andrew Svetlov <andrew.svetlov@gmail.com>
* bpo-47062: Implement asyncio.Runner context manager (GH-31799)Andrew Svetlov2022-03-241-18/+106
| | | Co-authored-by: Zachary Ware <zach@python.org>
* bpo-46829: Deprecate passing a message into Future.cancel() and ↵Andrew Svetlov2022-03-232-0/+11
| | | | | Task.cancel() (GH-31840) After a long deliberation we ended up feeling that the message argument for Future.cancel(), added in 3.9, was a bad idea, so we're deprecating it in 3.11 and plan to remove it in 3.13.
* bpo-45997: Fix asyncio.Semaphore re-acquiring order (GH-31910)Andrew Svetlov2022-03-221-6/+10
| | | Co-authored-by: Kumar Aditya <59607654+kumaraditya303@users.noreply.github.com>
* bpo-34790: Remove passing coroutine objects to asyncio.wait() (GH-31964)Andrew Svetlov2022-03-171-10/+4
| | | Co-authored-by: Yury Selivanov <yury@edgedb.com>
* bpo-47039: Normalize repr() of asyncio future and task objects (GH-31950)Andrew Svetlov2022-03-174-27/+19
|
* bpo-43253: Don't call shutdown() for invalid socket handles (GH-31892)Maximilian Hils2022-03-151-1/+1
|
* Drop accidentally added whitespaces in asyncio internals (GH-31900)Andrew Svetlov2022-03-151-1/+1
|
* bpo-46994: Accept explicit contextvars.Context in asyncio create_task() API ↵Andrew Svetlov2022-03-144-10/+26
| | | | (GH-31837)
* bpo-46805: Add low level UDP socket functions to asyncio (GH-31455)Alex Grönholm2022-03-134-0/+165
|
* bpo-46995: Deprecate missing asyncio.Task.set_name() for third-party task ↵Andrew Svetlov2022-03-131-1/+4
| | | | | implementations (GH-31838) Co-authored-by: Kumar Aditya <59607654+kumaraditya303@users.noreply.github.com>
* bpo-46771: Implement asyncio context managers for handling timeouts (GH-31394)Andrew Svetlov2022-03-102-0/+153
| | | | | | | | | | Example: async with asyncio.timeout(5): await some_task() Will interrupt the await and raise TimeoutError if some_task() takes longer than 5 seconds. Co-authored-by: Guido van Rossum <guido@python.org>
* bpo-46955: Expose asyncio.base_events.Server as asyncio.Server (GH-31760)Stefan Zabka2022-03-081-1/+1
| | | | | | This change aligns the documentation at https://docs.python.org/3/library/asyncio-eventloop.html#asyncio.Server with the actual implementation Co-authored-by: Andrew Svetlov <andrew.svetlov@gmail.com>
* Remove trailing spaces (GH-31695)Serhiy Storchaka2022-03-052-4/+4
|
* bpo-46771: Remove two controversial lines from Task.cancel() (GH-31623)Guido van Rossum2022-02-281-2/+5
| | | | | | | | | | | | | | | Also from the _asyncio C accelerator module, and adjust one test that the change caused to fail. For more discussion see the discussion starting here: https://github.com/python/cpython/pull/31394#issuecomment-1053545331 (Basically, @asvetlov proposed to return False from cancel() when there is already a pending cancellation, and I went along, even though it wasn't necessary for the task group implementation, and @agronholm has come up with a counterexample that fails because of this change. So now I'm changing it back to the old semantics (but still bumping the counter) until we can have a proper discussion about this.)
* Taskgroup tweaks (GH-31559)Tin Tvrtković2022-02-261-27/+23
| | | Now uses .cancel()/.uncancel(), for even fewer broken edge cases.
* bpo-46771: Implement task cancel requests counter (GH-31513)Tin Tvrtković2022-02-241-9/+21
| | | | | This changes cancelling() and uncancel() to return the count of pending cancellations. This can be used to avoid bugs in certain edge cases (e.g. two timeouts going off at the same time).
* Inherit asyncio proactor datagram transport from asyncio.DatagramTransport ↵Andrew Svetlov2022-02-221-1/+2
| | | | (#31512)
* bpo-46827: pass sock.type to getaddrinfo in sock_connect (GH-31499)Thomas Grainger2022-02-221-1/+3
| | | | | Co-authored-by: Thomas Grainger <tagrain@gmail.com> Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com> Co-authored-by: Andrew Svetlov <andrew.svetlov@gmail.com>
* bpo-45390: Propagate CancelledError's message from cancelled task to its ↵Andrew Svetlov2022-02-211-0/+5
| | | | | | awaiter (GH-31383) Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
* bpo-46796: Simplify handling of removed parameter "loop" in asyncio (GH-31431)Serhiy Storchaka2022-02-213-22/+7
|
* Raise TypeError if SSLSocket is passed to asyncio transport-based methods ↵Andrew Svetlov2022-02-202-10/+20
| | | | (GH-31442)
* bpo-46672: fix `NameError` in `asyncio.gather` if type check fails (GH-31187)Nikita Sobolev2022-02-201-1/+2
| | | Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
* bpo-46752: Uniform TaskGroup.__repr__ (GH-31409)Andrew Svetlov2022-02-201-8/+10
|
* bpo-46752: Slight improvements to TaskGroup API (GH-31398)Guido van Rossum2022-02-181-18/+4
| | | | | | | | | | | | | | | | | * Remove task group names (for now) We're not sure that they are needed, and once in the code we would never be able to get rid of them. Yury wrote: > Ideally, there should be a way for someone to build a "trace" > of taskgroups/task leading to the current running task. > We could do that using contextvars, but I'm not sure we should > do that in 3.11. * Pass optional name on to task in create_task() * Remove a bunch of unused stuff
* bpo-46752: Add TaskGroup; add Task..cancelled(),.uncancel() (GH-31270)Guido van Rossum2022-02-154-2/+252
| | | | | | | | | | | | | | | | | asyncio/taskgroups.py is an adaptation of taskgroup.py from EdgeDb, with the following key changes: - Allow creating new tasks as long as the last task hasn't finished - Raise [Base]ExceptionGroup (directly) rather than TaskGroupError deriving from MultiError - Instead of monkey-patching the parent task's cancel() method, add a new public API to Task The Task class has a new internal flag, `_cancel_requested`, which is set when `.cancel()` is called successfully. The `.cancelling()` method returns the value of this flag. Further `.cancel()` calls while this flag is set return False. To reset this flag, call `.uncancel()`. Thus, a Task that catches and ignores `CancelledError` should call `.uncancel()` if it wants to be cancellable again; until it does so, it is deemed to be busy with uninterruptible cleanup. This new Task API helps solve the problem where TaskGroup needs to distinguish between whether the parent task being cancelled "from the outside" vs. "from inside". Co-authored-by: Yury Selivanov <yury@edgedb.com> Co-authored-by: Andrew Svetlov <andrew.svetlov@gmail.com>
* bpo-46741: Update `asyncio.protocols.BufferedProtocol` docstring (31327)Alex Waygood2022-02-151-4/+0
| | | The docstring for `BufferedProtocol` states that the class is still an "experimental API", but it has been considered stable since 3.8.
* bpo-44011: New asyncio ssl implementation (#31275)Kumar Aditya2022-02-157-467/+721
| | | | | | | | | | | * bpo-44011: New asyncio ssl implementation Co-Authored-By: Andrew Svetlov <andrew.svetlov@gmail.com> * fix warning * fix typo Co-authored-by: Andrew Svetlov <andrew.svetlov@gmail.com>
* bpo-46487: Add `get_write_buffer_limits` to Write and _SSLProtocol ↵Emiya2022-02-012-0/+12
| | | | | transports (GH-30958) Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
* bpo-26552: Fixed case where failing `asyncio.ensure_future` did not close ↵Kumar Aditya2022-01-281-2/+8
| | | | the coroutine (#30288)
* bpo-46469: Make asyncio generic classes return GenericAlias (GH-30777)Kumar Aditya2022-01-223-6/+6
| | | | | | | | | | | | * bpo-46469: Make asyncio generic classes return GenericAlias * 📜🤖 Added by blurb_it. * Update Misc/NEWS.d/next/Library/2022-01-22-05-05-08.bpo-46469.plUab5.rst Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com> Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com> Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
* bpo-46310: simplify `for` loop in `asyncio/windows_events` (GH-30334)Nikita Sobolev2022-01-111-1/+1
|
* bpo-46278: fix typo introduced in GH-30427 (GH-30430)Kumar Aditya2022-01-061-2/+2
| | | Automerge-Triggered-By: GH:asvetlov
* Reflect 'context' arg in 'AbstractEventLoop.call_*()' methods (GH-30427)Andrew Svetlov2022-01-061-4/+4
|
* bpo-46239: improve error message when importing `asyncio.windows_events` ↵Nikita Sobolev2022-01-041-0/+5
| | | | (GH-30353)
* bpo-46238: reuse `_winapi` constants in `asyncio.windows_events` (GH-30352)Nikita Sobolev2022-01-041-3/+3
|
* bpo-23819: Fix asyncio tests on python optimized mode (GH-30195)Kumar Aditya2021-12-261-2/+2
|
* bpo-42413: Replace `concurrent.futures.TimeoutError` and ↵Kumar Aditya2021-12-191-2/+1
| | | | | `asyncio.TimeoutError` with builtin `TimeoutError` (GH-30197) Co-authored-by: Andrew Svetlov <andrew.svetlov@gmail.com>
* Re-add `reuse_address` parameter to `create_server` (GH-29733)Jim Crist-Harif2021-12-121-0/+6
| | | | | | | This parameter was accidentally removed when fixing https://bugs.python.org/issue45129, this reverts the unnecessary changes there. Co-authored-by: Andrew Svetlov <andrew.svetlov@gmail.com>