Commit Graph

849 Commits

Author SHA1 Message Date
Miss Islington (bot) a7e281150e
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:44 -07:00
Miss Islington (bot) a5c503f296
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:25:06 -07:00
Miss Islington (bot) 232156144c
gh-97545: Make Semaphore run faster. (GH-97549)
(cherry picked from commit 68c46ae68b)

Co-authored-by: Cyker Way <cykerway@gmail.com>
2022-09-26 16:57:52 -07:00
Miss Islington (bot) 43d8860aa2
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:23:48 -07:00
Miss Islington (bot) 646aa7efb3
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 10:01:14 -07:00
Miss Islington (bot) 9b710581a3
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 07:57:44 -07:00
Miss Islington (bot) f60bbf0a93
GH-74116: Allow multiple drain waiters for asyncio.StreamWriter (GH-94705)
(cherry picked from commit e5b2453e61)

Co-authored-by: Kumar Aditya <59607654+kumaraditya303@users.noreply.github.com>
2022-09-08 08:42:08 -07:00
Miss Islington (bot) 280130f035
gh-90467: StreamReaderProtocol - add strong reference to created task (GH-96323)
(cherry picked from commit e860e521ec)

Co-authored-by: Kirill <iam@python273.pw>
2022-09-08 08:39:20 -07:00
Miss Islington (bot) aa2142def6
bpo-45924: Fix asyncio incorrect traceback when future's exception is raised multiple times (GH-30274) (#94748)
(cherry picked from commit 86c1df1872)

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

Co-authored-by: Kumar Aditya <59607654+kumaraditya303@users.noreply.github.com>
2022-07-11 15:38:27 +01:00
Miss Islington (bot) 608ddd3277
gh-92841: Fix asyncio's RuntimeError: Event loop is closed (GH-92842) (GH-92904)
(cherry picked from commit 33880b4b1c)

Co-authored-by: Oleg Iarygin <oleg@arhadthedev.net>
2022-06-28 11:43:14 +02:00
Miss Islington (bot) 280749a8fd
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:08:05 -07:00
Miss Islington (bot) 2bcbc3113d
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:15:05 -07:00
Miss Islington (bot) 9d59381a5d
[3.10] bpo-45997: Fix asyncio.Semaphore re-acquiring order (GH-31910) (#32047)
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:15:24 +02:00
Miss Islington (bot) 88c243fd8d
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:22:01 -07:00
Miss Islington (bot) 8de434b332
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:36:35 -08:00
Miss Islington (bot) 6717edcf84
Inherit asyncio proactor datagram transport from asyncio.DatagramTransport (GH-31512) (GH-31514)
(cherry picked from commit cff4d5c5d2)

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

Co-authored-by: Andrew Svetlov <andrew.svetlov@gmail.com>
2022-02-23 14:04:49 +02:00
Miss Islington (bot) d327517b54
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:09:35 -08:00
Miss Islington (bot) f1916cde24
bpo-46672: fix `NameError` in `asyncio.gather` if type check fails (GH-31187) (GH-31440)
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
(cherry picked from commit 4ab8167b9c)

Co-authored-by: Nikita Sobolev <mail@sobolevn.me>

Co-authored-by: Nikita Sobolev <mail@sobolevn.me>
2022-02-20 17:28:42 +02:00
Andrew Svetlov dde048819f
[3.10] Raise TypeError if SSLSocket is passed to asyncio transport-based methods (GH-31442). (GH-31443)
(cherry picked from commit 1f9d4c93af)

Co-authored-by: Andrew Svetlov <andrew.svetlov@gmail.com>
2022-02-20 14:45:02 +02:00
Miss Islington (bot) 72c46462aa
bpo-46741: Update `asyncio.protocols.BufferedProtocol` docstring (GH-31327) (GH-31362)
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>

Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
2022-02-15 19:14:09 +02:00
Miss Islington (bot) e5e1441d41
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:30:03 -08:00
Kumar Aditya a5451c96a1
bpo-26552: Fixed case where failing `asyncio.ensure_future` did not close the coroutine (#30288) (#31003) 2022-01-28 22:57:18 -08:00
Miss Islington (bot) 90e2998db7
[3.10] bpo-46469: Make asyncio generic classes return GenericAlias (GH-30777) (#30784)
* bpo-46469: Make asyncio generic classes return GenericAlias (GH-30777)

* 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>
(cherry picked from commit ea5b96842e)

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

* Fix tests

Co-authored-by: Kumar Aditya <59607654+kumaraditya303@users.noreply.github.com>
Co-authored-by: Andrew Svetlov <andrew.svetlov@gmail.com>
2022-01-22 14:28:51 +02:00
Miss Islington (bot) 861a9aaf0f
bpo-46278: fix typo introduced in GH-30427 (GH-30430) (GH-30431)
Automerge-Triggered-By: GH:asvetlov
(cherry picked from commit b50e5e916a)

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

Co-authored-by: Kumar Aditya <59607654+kumaraditya303@users.noreply.github.com>
2022-01-06 16:44:22 +02:00
Miss Islington (bot) 8670fbe4d2
Reflect 'context' arg in 'AbstractEventLoop.call_*()' methods (GH-30427) (GH-30428)
(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:04:05 +02:00
Miss Islington (bot) cf48a14819
bpo-46239: improve error message when importing `asyncio.windows_events` (GH-30353) (#30388)
(cherry picked from commit 5a2a65096c)

Co-authored-by: Nikita Sobolev <mail@sobolevn.me>

Co-authored-by: Nikita Sobolev <mail@sobolevn.me>
2022-01-04 11:22:26 +02:00
Miss Islington (bot) 305236e03a
bpo-37658: Actually return result in race condition (GH-29202)
(cherry picked from commit 934a826237)

Co-authored-by: Sam Bull <aa6bs0@sambull.org>
2021-11-29 00:37:34 -08:00
Miss Islington (bot) d6afe3be01
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:42:39 -07:00
Miss Islington (bot) 164dddf5f8
bpo-45416: Fix use of asyncio.Condition() with explicit Lock objects (GH-28850)
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
(cherry picked from commit 1a7892414e)

Co-authored-by: Joongi Kim <joongi@lablup.com>
2021-10-10 09:25:14 -07:00
Christian Clauss cfca4a6774
[3.10] Fix typos in the Lib directory (GH-28775) (GH-28804)
Fix typos in the Lib directory as identified by codespell.

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

Co-authored-by: Christian Clauss <cclauss@me.com>
2021-10-07 11:49:47 -04:00
Miss Islington (bot) 12073fc6fd
Trivial typo in docstring (#27504)
(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:45 +02:00
Miss Islington (bot) 6fc1efa454
bpo-44740: Lowercase "internet" and "web" where appropriate. (GH-27378) (GH-27380)
Co-authored-by: Łukasz Langa <lukasz@langa.pl>
(cherry picked from commit 11749e2dc2)

Co-authored-by: Mariusz Felisiak <felisiak.mariusz@gmail.com>
2021-07-27 00:34:32 +02:00
Ethan Furman 1b4addf3cb
[3.10] bpo-43945: [Enum] reduce scope of new format() behavior (GH-26752)
* [Enum] reduce scope of new format behavior

Instead of treating all Enums the same for format(), only user mixed-in
enums will be affected.  In other words, IntEnum and IntFlag will not be
changing the format() behavior, due to the requirement that they be
drop-in replacements of existing integer constants.

If a user creates their own integer-based enum, then the new behavior
will apply:

    class Grades(int, Enum):
        A = 5
        B = 4
        C = 3
        D = 2
        F = 0

Now:  format(Grades.B)  -> DeprecationWarning and '4'
3.12:                   -> no warning, and 'B'.

(cherry picked from commit f60b07ab6c)

Co-authored-by: Ethan Furman <ethan@stoneleaf.us>
2021-06-18 14:25:42 -07:00
Pablo Galindo 7719953b30
bpo-44011: Revert "New asyncio ssl implementation (GH-17975)" (GH-25848)
This reverts commit 5fb06edbbb and all
subsequent dependent commits.
2021-05-03 16:21:59 +01:00
Christian Heimes 37ebdf0a86
bpo-44011: Fix asyncio tests without ssl module (GH-25840)
Signed-off-by: Christian Heimes <christian@python.org>
2021-05-03 09:38:56 +02:00
Andrew Svetlov 5fb06edbbb
bpo-44011: New asyncio ssl implementation (#17975) 2021-05-03 00:34:15 +03:00
Roberto Hueso 55e5c680dd
bpo-43989: Add signal format specifier for unix_events (GH-25769)
Add format specifier for IntEnum references to avoid 3.12 deprecation warning.
2021-05-01 13:34:29 -07:00
Serhiy Storchaka 172c0f2752
bpo-39529: Deprecate creating new event loop in asyncio.get_event_loop() (GH-23554)
asyncio.get_event_loop() emits now a deprecation warning when it creates a new event loop.
In future releases it will became an alias of asyncio.get_running_loop().
2021-04-25 13:40:44 +03:00
Richard Kojedzinszky 17ef4319a3
bpo-41891: ensure asyncio.wait_for waits for task completion (#22461) 2020-12-18 09:26:04 -08:00
Chris Jerdonek 66d3b589c4
bpo-38323: Add guard clauses in MultiLoopChildWatcher. (#22756)
This is a trivial refactor in preparation for a fix for bpo-38323.
2020-12-16 19:50:25 +02:00
Victor Stinner 99d28c5670
bpo-40364: asyncio uses os.waitstatus_to_exitcode() (GH-23798)
test_unix_events.py no longer checks if waitstatus_to_exitcode() mock
has been called or not to make the test more functional, rather than
checking the exact implementation.
2020-12-16 12:11:24 +01:00
Serhiy Storchaka 8a62887dfb
bpo-42582: Remove asyncio._all_tasks_compat(). (GH-23664)
It was used to implement now removed asyncio.Task.all_tasks().
2020-12-06 18:54:33 +02:00
Zackery Spytz 8085f742f4
bpo-34215: Clarify IncompleteReadError message when "expected" is None (GH-21925)
Co-Authored-By: Tyler Bell <mrbell321@gmail.com>
2020-11-28 16:27:28 +02:00
Wansoo Kim 5b0194ed31
bpo-41241: Unnecessary Type casting in 'if condition' (GH-21396)
This is my first issue!
So, if there's anything wrong, please tell me!

Also, thank you always for all the contributors!

Automerge-Triggered-By: GH:asvetlov
2020-11-28 03:37:08 -08:00
Yurii Karabas e4fe303b8c
bpo-42392: Remove loop parameter from asyncio.tasks and asyncio.subprocess (GH-23521) 2020-11-28 10:21:17 +02:00
Alex Grönholm e3ef4d7f65
bpo-41332: Added missing connect_accepted_socket() to AbstractEventLoop (GH-21533)
Co-authored-by: Andrew Svetlov <andrew.svetlov@gmail.com>
Co-authored-by: Kyle Stanley <aeros167@gmail.com>
2020-11-26 12:09:12 +02:00
Yurii Karabas f533cb80cb
bpo-42392: Remove loop parameter from asyncio.streams (GH-23517) 2020-11-26 09:36:37 +02:00
Yurii Karabas b9127dd6ee
bpo-42392: Improve removal of *loop* parameter in asyncio primitives (GH-23499)
* Update code after merge review from 1st1

* Use a sentinel approach for loop parameter
Remove unnecessary _get_running_loop patching

* Use more clear function name (_verify_parameter_is_marker -> _verify_no_loop)

* Add init method to _LoopBoundMixin to check that loop param wasn't used
2020-11-25 06:50:44 -05:00
Yurii Karabas 0ec34cab9d
bpo-42392: Remove loop parameter form asyncio locks and Queue (#23420)
Co-authored-by: Andrew Svetlov <andrew.svetlov@gmail.com>
2020-11-24 20:08:54 +02:00
Diogo Dutra 7e5ef0a571
bpo-42140: Improve asyncio.wait function (GH-22938)
# 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
2020-11-10 14:12:52 -08:00