Commit Graph

826 Commits

Author SHA1 Message Date
Łukasz Langa 9e9c71d09e
[3.9] gh-121957: Emit audit events for python -i and python -m asyncio (GH-122120) 2024-07-22 13:49:47 +02:00
jkriegshauser 40d77b9367
[3.9] gh-116773: Fix overlapped memory corruption crash (GH-116774) (GH-117080)
Co-authored-by: Łukasz Langa <lukasz@langa.pl>
2024-03-27 16:24:46 +01:00
Miss Islington (bot) 081e95165e
Fix missing `f` prefix on f-strings (GH-91910)
(cherry picked from commit f882d33778)

Co-authored-by: Alexander Shadchin <alexandr.shadchin@gmail.com>
2022-04-27 00:01:11 -07:00
Miss Islington (bot) f84fb55659
bpo-27929: resolve names only for AF_INET/AF_INET6 with asyncio (GH-32131)
Co-authored-by: Andrew Svetlov <andrew.svetlov@gmail.com>
(cherry picked from commit 5c30388f3c)

Co-authored-by: Vincent Bernat <vincent@bernat.ch>
2022-03-28 15:16:30 -07:00
Andrew Svetlov f47984b560
[3.9] bpo-45997: Fix asyncio.Semaphore re-acquiring order (GH-31910) (GH-32049)
Co-authored-by: Kumar Aditya <59607654+kumaraditya303@users.noreply.github.com>.
(cherry picked from commit 32e77154dd)

Co-authored-by: Andrew Svetlov <andrew.svetlov@gmail.com>
2022-03-22 17:16:27 +02:00
Miss Islington (bot) 64a68c39cb
bpo-43253: Don't call shutdown() for invalid socket handles (GH-31892)
(cherry picked from commit 70155412f1)

Co-authored-by: Maximilian Hils <git@maximilianhils.com>
2022-03-15 08:23:47 -07:00
Miss Islington (bot) 20e88f78a3
bpo-46955: Expose asyncio.base_events.Server as asyncio.Server (GH-31760)
This change aligns the documentation at https://docs.python.org/3/library/asyncio-eventloop.htmlGH-asyncio.Server
with the actual implementation

Co-authored-by: Andrew Svetlov <andrew.svetlov@gmail.com>
(cherry picked from commit da80d6b2f3)

Co-authored-by: Stefan Zabka <zabkaste@informatik.hu-berlin.de>
2022-03-08 13:32:46 -08:00
Miss Islington (bot) f3bb8fe4e8
Inherit asyncio proactor datagram transport from asyncio.DatagramTransport (GH-31512)
(cherry picked from commit cff4d5c5d2)

Co-authored-by: Andrew Svetlov <andrew.svetlov@gmail.com>
2022-02-22 16:08:43 -08:00
Miss Islington (bot) 29e8c43b32
bpo-46827: pass sock.type to getaddrinfo in sock_connect (GH-31499)
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>
(cherry picked from commit 8fb94893e4)

Co-authored-by: Thomas Grainger <tagrain@gmail.com>
2022-02-22 13:10:04 -08:00
Andrew Svetlov 64705e6a94
[3.9] Raise TypeError if SSLSocket is passed to asyncio transport-based methods (GH-31442) (GH-31444)
(cherry picked from commit 1f9d4c93af)

Co-authored-by: Andrew Svetlov <andrew.svetlov@gmail.com>
2022-02-20 14:49:27 +02:00
Andrew Svetlov a6116a980c
[3.9] bpo-46672: fix `NameError` in `asyncio.gather` if type check fails (GH-31187) (GH-31441)
Co-authored-by: Nikita Sobolev <mail@sobolevn.me>
2022-02-20 14:39:21 +02:00
Miss Islington (bot) c292118ef3
bpo-46741: Update `asyncio.protocols.BufferedProtocol` docstring (31327)
The docstring for `BufferedProtocol` states that the class is still an "experimental API", but it has been considered stable since 3.8.
(cherry picked from commit 1d81fdc4c0)

Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
2022-02-15 09:08:24 -08:00
Miss Islington (bot) e4a6e54902
bpo-46487: Add `get_write_buffer_limits` to Write and _SSLProtocol transports (GH-30958)
Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
(cherry picked from commit 64568acbd8)

Co-authored-by: Emiya <importz750@gmail.com>
2022-02-01 11:29:45 -08:00
Kumar Aditya 6ed874f8c5
[3.9] bpo-46469: Make asyncio generic classes return GenericAlias (GH-30777) (GH-30785)
Automerge-Triggered-By: GH:asvetlov
2022-01-22 04:52:24 -08:00
Miss Islington (bot) cb0683128b
bpo-46278: fix typo introduced in GH-30427 (GH-30430)
Automerge-Triggered-By: GH:asvetlov
(cherry picked from commit b50e5e916a)

Co-authored-by: Kumar Aditya <59607654+kumaraditya303@users.noreply.github.com>
2022-01-06 05:51:44 -08:00
Miss Islington (bot) 0aa8bbfe1e
Reflect 'context' arg in 'AbstractEventLoop.call_*()' methods (GH-30427) (#30429)
(cherry picked from commit 3e43fac250)

Co-authored-by: Andrew Svetlov <andrew.svetlov@gmail.com>

Co-authored-by: Andrew Svetlov <andrew.svetlov@gmail.com>
2022-01-06 15:03:11 +02:00
Miss Islington (bot) 86d1b8c13f
bpo-46239: improve error message when importing `asyncio.windows_events` (GH-30353)
(cherry picked from commit 5a2a65096c)

Co-authored-by: Nikita Sobolev <mail@sobolevn.me>
2022-01-04 01:13:56 -08:00
Miss Islington (bot) 07229054a1
[3.9] bpo-23819: Fix asyncio tests on python optimized mode (GH-30195) (GH-30265)
(cherry picked from commit a23ab7b6d8)

Co-authored-by: Kumar Aditya <59607654+kumaraditya303@users.noreply.github.com>
2021-12-26 13:54:18 +02:00
Miss Islington (bot) 99a9b34331
bpo-37658: Actually return result in race condition (GH-29202) (GH-29832)
(cherry picked from commit 934a826237)

Co-authored-by: Sam Bull <aa6bs0@sambull.org>

Co-authored-by: Sam Bull <aa6bs0@sambull.org>
2021-11-30 15:39:13 +02:00
Miss Islington (bot) 50e8b2ff02
Cleanup a couple of comments left on PR 28775 post-merge. (GH-29079)
(cherry picked from commit 1dfac27dff)

Co-authored-by: Gregory P. Smith <greg@krypto.org>
2021-10-20 09:50:27 -07:00
Christian Clauss 4346b81cc6
[3.9] Fix typos in the Lib directory (GH-28775) (GH-28803)
Fix typos in the Lib directory as identified by codespell.

Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
(cherry picked from commit 745c9d9dfc)

Automerge-Triggered-By: GH:JulienPalard
2021-10-07 08:42:38 -07:00
Serhiy Storchaka c967bd523c
[3.9] bpo-45097: Remove incorrect deprecation warnings in asyncio. (GH-28153)
Deprecation warnings about the loop argument were incorrectly emitted
in cases when the loop argument was used inside the asyncio library,
not from user code.
2021-09-04 20:54:50 +03:00
Sam Bull b2779b2aa1
[3.9] bpo-44815: Always show deprecation in asyncio.gather/sleep() (GH-27569)
Co-authored-by: Łukasz Langa <lukasz@langa.pl>
2021-08-18 20:47:55 +02:00
Miss Islington (bot) 2efa78180d
Trivial typo in docstring (#27505)
(cherry picked from commit 4b4227b907)

Co-authored-by: Jesús Cea <jcea@jcea.es>

Co-authored-by: Jesús Cea <jcea@jcea.es>
2021-07-31 07:04:38 +02:00
Miss Islington (bot) 82dbfd5a04
bpo-41891: ensure asyncio.wait_for waits for task completion (GH-22461) (#23840)
(cherry picked from commit 17ef4319a3)

Co-authored-by: Richard Kojedzinszky <rkojedzinszky@users.noreply.github.com>

Co-authored-by: Richard Kojedzinszky <rkojedzinszky@users.noreply.github.com>
2020-12-18 11:19:10 -08:00
Miss Islington (bot) bf0eed3e60
bpo-38323: Add guard clauses in MultiLoopChildWatcher. (GH-22756)
This is a trivial refactor in preparation for a fix for bpo-38323.
(cherry picked from commit 66d3b589c4)

Co-authored-by: Chris Jerdonek <chris.jerdonek@gmail.com>
2020-12-16 10:10:37 -08:00
Miss Islington (bot) df6c8bcffe
bpo-34215: Clarify IncompleteReadError message when "expected" is None (GH-21925) (GH-23539)
Co-Authored-By: Tyler Bell <mrbell321@gmail.com>
(cherry picked from commit 8085f742f4)

Co-authored-by: Zackery Spytz <zspytz@gmail.com>

Co-authored-by: Zackery Spytz <zspytz@gmail.com>
2020-11-28 17:07:51 +02:00
Miss Islington (bot) 33922cb0aa
bpo-42140: Improve asyncio.wait function (GH-22938)
GH- Improve asyncio.wait function

The original code creates the futures set two times.
We can create this set before, avoiding the second creation.

This new behaviour [breaks the aiokafka library](https://github.com/aio-libs/aiokafka/pull/672), because it gives an iterator to that function, so the second iteration become empty.

Automerge-Triggered-By: GH:1st1
(cherry picked from commit 7e5ef0a571)

Co-authored-by: Diogo Dutra <diogodutradamata@gmail.com>
2020-11-10 15:10:57 -08:00
Miss Islington (bot) 90115a2cf7
bpo-42183: Fix a stack overflow error for asyncio Task or Future repr() (GH-23020)
The overflow occurs under some circumstances when a task or future
recursively returns itself.

Co-authored-by: Kyle Stanley <aeros167@gmail.com>
(cherry picked from commit 42d873c63a)

Co-authored-by: Andrew Svetlov <andrew.svetlov@gmail.com>
2020-11-10 06:20:52 -08:00
Miss Skeleton (bot) ff852aabf2
bpo-42230: Improve asyncio documentation regarding accepting sets vs iterables (GH-23073)
People call wait() and as_completed() with various non-set iterables,
a list should be the most common but there are others as well[1].

Considering typeshed also documents wait()[2] and as_completed()[3]
as accepting arbitrary iterables I think it's a good idea to document
the status quo better.

[1] https://github.com/aio-libs/aiokafka/pull/672
[2] 620989bac5/stdlib/3/asyncio/tasks.pyiGH-L161
[3] 620989bac5/stdlib/3/asyncio/tasks.pyiGH-L40
(cherry picked from commit 3d86d090dc)

Co-authored-by: Jakub Stasiak <jakub@stasiak.at>
2020-11-02 03:19:45 -08:00
Miss Islington (bot) 7dfcc8e079
bpo-39651: Fix asyncio proactor _write_to_self() (GH-22197)
Fix a race condition in the call_soon_threadsafe() method of
asyncio.ProactorEventLoop: do nothing if the self-pipe socket has
been closed.
(cherry picked from commit 1b0f0e3d7d)

Co-authored-by: Victor Stinner <vstinner@python.org>
2020-09-12 00:11:38 -07:00
Miss Islington (bot) a2680058ee
bpo-41696: Fix handling of debug mode in asyncio.run (GH-22069) (#22071)
* bpo-41696: Fix handling of debug mode in asyncio.run

This allows PYTHONASYNCIODEBUG or -X dev to enable asyncio debug mode
when using asyncio.run

* 📜🤖 Added by blurb_it.

Co-authored-by: hauntsaninja <>
Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
(cherry picked from commit 0770ad948c)

Co-authored-by: Shantanu <12621235+hauntsaninja@users.noreply.github.com>

Co-authored-by: Shantanu <12621235+hauntsaninja@users.noreply.github.com>
2020-09-03 13:54:09 -07:00
Miss Islington (bot) 49571c0b0e
bpo-39010: Fix errors logged on proactor loop restart (GH-22017) (#22034)
Stopping and restarting a proactor event loop on windows can lead to
spurious errors logged (ConnectionResetError while reading from the
self pipe). This fixes the issue by ensuring that we don't attempt
to start multiple copies of the self-pipe reading loop.
(cherry picked from commit ea5a6363c3)

Co-authored-by: Ben Darnell <ben@bendarnell.com>

Co-authored-by: Ben Darnell <ben@bendarnell.com>
2020-09-03 12:38:29 -07:00
Miss Islington (bot) 9de6be4e2a
bpo-37658: Fix asyncio.wait_for() to respect waited task status (GH-21894) (GH-21964)
Currently, if `asyncio.wait_for()` itself is cancelled it will always
raise `CancelledError` regardless if the underlying task is still
running.  This is similar to a race with the timeout, which is handled
already.
(cherry picked from commit a2118a1462)

Co-authored-by: Elvis Pranskevichus <elvis@magic.io>
2020-08-26 19:15:35 +02:00
Miss Islington (bot) 1036ccb55d
bpo-32751: Wait for task cancel in asyncio.wait_for() when timeout <= 0 (GH-21895) (GH-21963)
When I was fixing bpo-32751 back in GH-7216 I missed the case when
*timeout* is zero or negative.  This takes care of that.

Props to @aaliddell for noticing the inconsistency.
(cherry picked from commit c517fc7121)

Co-authored-by: Elvis Pranskevichus <elvis@magic.io>
2020-08-26 19:14:59 +02:00
Miss Islington (bot) a2d00f0473
bpo-41572: Fix grammar in BaseTransport.close docstring (GH-21914) (#21929)
Fix grammar in BaseTransport.close docstring.

https://bugs.python.org/issue41572

Signed-off-by: Cleber Rosa <crosa@redhat.com>
(cherry picked from commit 1afb42cfa8)

Co-authored-by: Cleber Rosa <cleber.gnu@gmail.com>
2020-08-21 17:49:40 +05:30
Miss Islington (bot) d6bdf6d52f
bpo-40782: Change asyncio.AbstractEventLoop.run_in_executor to be a method not a coroutine (GH-21852)
asyncio.AbstractEventLoop.run_in_executor should be a method that returns an asyncio Future, not an async method.
This matches the concrete implementations, and the documentation better.
(cherry picked from commit 29f84294d8)

Co-authored-by: James Weaver <james.barrett@bbc.co.uk>
2020-08-17 07:40:26 -07:00
Miss Islington (bot) 1d16229f3f
bpo-41467: Fix asyncio recv_into() on Windows (GH-21720)
On Windows, fix asyncio recv_into() return value when the socket/pipe
is closed (BrokenPipeError): return 0 rather than an empty byte
string (b'').
(cherry picked from commit 602a971a2a)

Co-authored-by: Victor Stinner <vstinner@python.org>
2020-08-03 18:00:29 -07:00
Miss Islington (bot) 4ff8e5ba4f
bpo-41317: Remove reader on cancellation in asyncio.loop.sock_accept() (GH-21595)
(cherry picked from commit 0dd98c2d00)

Co-authored-by: Alex Grönholm <alex.gronholm@nextday.fi>
2020-07-23 13:02:47 -07:00
Miss Islington (bot) 46634b7aa8
bpo-37703: improve asyncio.gather documentation regarding cancellation (GH-15312)
These changes updates the doc to comprehensively mention the behaviour of gather.cancel()

Automerge-Triggered-By: @asvetlov
(cherry picked from commit d42528a3a2)

Co-authored-by: Vinay Sharma <vinay04sharma@icloud.com>
2020-07-20 02:01:39 -07:00
Miss Islington (bot) df59293bf0
bpo-40967: Remove deprecated asyncio.Task.current_task() and asyncio.Task.all_tasks() (GH-20874)
(cherry picked from commit 004e64e805)

Co-authored-by: Rémi Lapeyre <remi.lapeyre@lenstra.fr>
2020-07-01 21:06:51 -07:00
Miss Islington (bot) cdb015b7ed
Fix asyncio.to_thread() documented return type (GH-20547)
When I wrote the documentation for `asyncio.to_thread()`, I mistakenly assumed that `return await loop.run_in_executor(...)` within an async def function would return a Future. In reality, it returns a coroutine.

This likely won't affect typical usage of `asyncio.to_thread()`, but it's important for the documentation to be correct here. In general, we also tend to avoid returning futures from high-level APIs in asyncio.
(cherry picked from commit 2b201369b4)

Co-authored-by: Kyle Stanley <aeros167@gmail.com>
2020-05-31 00:26:20 -07:00
Miss Islington (bot) 3a2667d91e
bpo-30064: Fix asyncio loop.sock_* race condition issue (GH-20369)
(cherry picked from commit 210a137396)

Co-authored-by: Fantix King <fantix.king@gmail.com>
2020-05-27 13:39:03 -07:00
Miss Islington (bot) 3e650545bf
bpo-32309: Add support for contextvars in asyncio.to_thread() (GH-20278)
Allows contextvars from the main thread to be accessed in the separate thread used in `asyncio.to_thread()`. See the [discussion](https://github.com/python/cpython/pull/20143GH-discussion_r427808225) in GH-20143 for context.

Automerge-Triggered-By: @aeros
(cherry picked from commit 0f56263e62)

Co-authored-by: Kyle Stanley <aeros167@gmail.com>
2020-05-20 22:38:00 -07:00
Miss Islington (bot) 4a1dba7bb8
s/wakup/wakeup (GH-20250)
(as title)

Automerge-Triggered-By: @Mariatta
(cherry picked from commit f2947e354c)

Co-authored-by: Kunal Bhalla <bhalla.kunal@gmail.com>
2020-05-20 10:58:47 -07:00
Miss Islington (bot) e2991308c9
bpo-32309: Implement asyncio.to_thread() (GH-20143)
Implements `asyncio.to_thread`, a coroutine for asynchronously running IO-bound functions in a separate thread without blocking the event loop. See the discussion starting from [here](https://github.com/python/cpython/pull/18410GH-issuecomment-628930973) in GH-18410 for context.

Automerge-Triggered-By: @aeros
(cherry picked from commit cc2bbc2227)

Co-authored-by: Kyle Stanley <aeros167@gmail.com>
2020-05-19 03:03:25 -07:00
Chris Jerdonek da742ba826
bpo-31033: Improve the traceback for cancelled asyncio tasks (GH-19951)
When an asyncio.Task is cancelled, the exception traceback now
starts with where the task was first interrupted.  Previously,
the traceback only had "depth one."
2020-05-17 22:47:31 -07:00
Chris Jerdonek 1ce5841eca
bpo-31033: Add a msg argument to Future.cancel() and Task.cancel() (GH-19979) 2020-05-15 16:55:50 -07:00
romasku 382a5635bd
bpo-40607: Reraise exception during task cancelation in asyncio.wait_for() (GH-20054)
Currently, if asyncio.wait_for() timeout expires, it cancels
inner future and then always raises TimeoutError. In case
those future is task, it can handle cancelation mannually,
and those process can lead to some other exception. Current
implementation silently loses thoses exception.

To resolve this, wait_for will check was the cancelation
successfull or not. In case there was exception, wait_for
will reraise it.

Co-authored-by: Roman Skurikhin <roman.skurikhin@cruxlab.com>
2020-05-15 13:12:05 -07:00
Victor Stinner 90549676e0
bpo-40443: Remove unused imports in the stdlib (GH-19803) 2020-04-30 11:26:33 +02:00