summaryrefslogtreecommitdiffstats
path: root/Lib/asyncio
Commit message (Collapse)AuthorAgeFilesLines
* bpo-41891: ensure asyncio.wait_for waits for task completion (GH-22461)Miss Islington (bot)2020-12-181-1/+4
| | | | | (cherry picked from commit 17ef4319a34f5a2f95e7823dfb5f5b8cff11882d) Co-authored-by: Richard Kojedzinszky <rkojedzinszky@users.noreply.github.com>
* bpo-38323: Add guard clauses in MultiLoopChildWatcher. (GH-22756)Miss Islington (bot)2020-12-161-14/+18
| | | | | | This is a trivial refactor in preparation for a fix for bpo-38323. (cherry picked from commit 66d3b589c44fcbcf9afe1e442d9beac3bd8bcd34) Co-authored-by: Chris Jerdonek <chris.jerdonek@gmail.com>
* bpo-34215: Clarify IncompleteReadError message when "expected" is None ↵Miss Islington (bot)2020-11-281-1/+2
| | | | | | | (GH-21925) (#23540) Co-Authored-By: Tyler Bell <mrbell321@gmail.com> (cherry picked from commit 8085f742f4adfbc85f13fc734dfab036aa23acfb) Co-authored-by: Zackery Spytz <zspytz@gmail.com>
* bpo-42183: Fix a stack overflow error for asyncio Task or Future repr() ↵Miss Islington (bot)2020-11-101-3/+22
| | | | | | | | | | | (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 42d873c63aa9d160c132be4a34599531574db12c) Co-authored-by: Andrew Svetlov <andrew.svetlov@gmail.com>
* [3.8] bpo-42230: Improve asyncio documentation regarding accepting sets vs ↵Jakub Stasiak2020-11-021-2/+2
| | | | | | | | | | | | | | | | | iterables (GH-23073) (GH-23105) 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] https://github.com/python/typeshed/blob/620989bac572f30349b95590ebe81a73ce0fe862/stdlib/3/asyncio/tasks.pyiGH-L161 [3] https://github.com/python/typeshed/blob/620989bac572f30349b95590ebe81a73ce0fe862/stdlib/3/asyncio/tasks.pyiGH-L40. (cherry picked from commit 3d86d090dcbbdfdd3e5a5951cab30612d6131222) Co-authored-by: Jakub Stasiak <jakub@stasiak.at>
* bpo-39651: Fix asyncio proactor _write_to_self() (GH-22197)Miss Islington (bot)2020-09-122-9/+20
| | | | | | | | 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 1b0f0e3d7d03155da1cf9769a847874d559e57e3) Co-authored-by: Victor Stinner <vstinner@python.org>
* bpo-41696: Fix handling of debug mode in asyncio.run (GH-22069) (#22072)Miss Islington (bot)2020-09-031-2/+3
| | | | | | | | | | | | | | | | * 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 0770ad948cb6d9f7f6c4002efd83e27c27069808) Co-authored-by: Shantanu <12621235+hauntsaninja@users.noreply.github.com> Co-authored-by: Shantanu <12621235+hauntsaninja@users.noreply.github.com>
* bpo-39010: Fix errors logged on proactor loop restart (GH-22017) (#22035)Miss Islington (bot)2020-09-032-2/+14
| | | | | | | | | | | 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 ea5a6363c3f8cc90b7c0cc573922b10f296073b6) Co-authored-by: Ben Darnell <ben@bendarnell.com> Co-authored-by: Ben Darnell <ben@bendarnell.com>
* [3.8] bpo-32751: Wait for task cancel in asyncio.wait_for() when timeout <= ↵Elvis Pranskevichus2020-08-261-2/+7
| | | | | | | | | 0 (GH-21895) (#21967) 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 c517fc712105c8e5930cb42baaebdbe37fc3e15f)
* bpo-37658: Fix asyncio.wait_for() to respect waited task status (GH-21894) ↵Miss Islington (bot)2020-08-261-3/+6
| | | | | | | | | | | | (#21965) 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 a2118a14627256197bddcf4fcecad4c264c1e39d) Co-authored-by: Elvis Pranskevichus <elvis@magic.io>
* bpo-41572: Fix grammar in BaseTransport.close docstring (GH-21914) (GH-21930)Miss Islington (bot)2020-08-211-2/+2
| | | | | | | | | | Fix grammar in BaseTransport.close docstring. https://bugs.python.org/issue41572 Signed-off-by: Cleber Rosa <crosa@redhat.com> (cherry picked from commit 1afb42cfa82dad0ddd726f59c6c5fcb3962314db) Co-authored-by: Cleber Rosa <cleber.gnu@gmail.com>
* bpo-40782: Change asyncio.AbstractEventLoop.run_in_executor to be a method ↵Miss Islington (bot)2020-08-171-1/+1
| | | | | | | | | 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 29f84294d88ec493c2de9d6e8dbc12fae3778771) Co-authored-by: James Weaver <james.barrett@bbc.co.uk>
* bpo-41467: Fix asyncio recv_into() on Windows (GH-21720)Miss Islington (bot)2020-08-041-1/+1
| | | | | | | | 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 602a971a2af3a685d625c912c400cadd452718b1) Co-authored-by: Victor Stinner <vstinner@python.org>
* bpo-37703: improve asyncio.gather documentation regarding cancellation ↵Miss Islington (bot)2020-07-201-0/+7
| | | | | | | | | | (GH-15312) These changes updates the doc to comprehensively mention the behaviour of gather.cancel() Automerge-Triggered-By: @asvetlov (cherry picked from commit d42528a3a2c7d79fd2e6c9f2a02f3ce12d44c8cc) Co-authored-by: Vinay Sharma <vinay04sharma@icloud.com>
* s/wakup/wakeup (GH-20250)Miss Islington (bot)2020-05-201-1/+1
| | | | | | | | (as title) Automerge-Triggered-By: @Mariatta (cherry picked from commit f2947e354c95d246b1836ac78d4c820c420e259b) Co-authored-by: Kunal Bhalla <bhalla.kunal@gmail.com>
* bpo-39764: Make Task.get_stack accept ag_frame (GH-18669)Miss Islington (bot)2020-03-021-3/+10
| | | | | | Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com> (cherry picked from commit 4482337decdbd0c6e2150346a68b3616bda664aa) Co-authored-by: Lidi Zheng <scallopsky@gmail.com>
* bpo-38356: Fix ThreadedChildWatcher thread leak in test_asyncio (GH-16552)Miss Islington (bot)2020-01-121-1/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Motivation for this PR (comment from @vstinner in bpo issue): ``` Warning seen o AMD64 Ubuntu Shared 3.x buildbot: https://buildbot.python.org/all/GH-/builders/141/builds/2593 test_devnull_output (test.test_a=syncio.test_subprocess.SubprocessThreadedWatcherTests) ... Warning -- threading_cleanup() failed to cleanup 1 threads (count: 1, dangling: 2) ``` The following implementation details for the new method are TBD: 1) Public vs private 2) Inclusion in `close()` 3) Name 4) Coroutine vs subroutine method 5) *timeout* parameter If it's a private method, 3, 4, and 5 are significantly less important. I started with the most minimal implementation that fixes the dangling threads without modifying the regression tests, which I think is particularly important. I typically try to avoid directly modifying existing tests as much as possible unless it's necessary to do so. However, I am open to changing any part of this. https://bugs.python.org/issue38356 (cherry picked from commit 0ca7cc7fc0518c24dc9b78c38418e6064e64f148) Co-authored-by: Kyle Stanley <aeros167@gmail.com>
* [3.8] bpo-39191: Fix RuntimeWarning in asyncio test (GH-17863) (#17894)Andrew Svetlov2020-01-071-3/+3
| | | | | | https://bugs.python.org/issue39191. (cherry picked from commit 10ac0cded26d91c3468e5e5a87cecad7fc0bcebd) Co-authored-by: Andrew Svetlov <andrew.svetlov@gmail.com>
* [3.8] bpo-39191: Don't spawn a task before failing (GH-17796) (GH-17820)Andrew Svetlov2020-01-041-3/+7
| | | | | (cherry picked from commit 3a5de511596f17575de082dcb8d43d63b2bd2da9) Co-authored-by: Andrew Svetlov <andrew.svetlov@gmail.com>
* Fix import path for asyncio.TimeoutError (GH-17691)Miss Islington (bot)2019-12-241-2/+2
| | | | | (cherry picked from commit 025eeaa19607b2a80c979668dad405f567444573) Co-authored-by: Andrew Svetlov <andrew.svetlov@gmail.com>
* bpo-37228: Fix loop.create_datagram_endpoint()'s usage of SO_REUSEADDR ↵Miss Islington (bot)2019-12-091-7/+18
| | | | | | | (GH-17311) (#17529) (cherry picked from commit ab513a38c98695f271e448fe2cb7c5e39eeaaaaf) Co-authored-by: Kyle Stanley <aeros167@gmail.com>
* bpo-39006: Fix asyncio when the ssl module is missing (GH-17524)Miss Islington (bot)2019-12-091-10/+10
| | | | | | | Fix asyncio when the ssl module is missing: only check for ssl.SSLSocket instance if the ssl module is available. (cherry picked from commit 82b4950b5e92bec343a436b3f9c116400b66e1b9) Co-authored-by: Victor Stinner <vstinner@python.org>
* [3.8] bpo-37404: Raising value error if an SSLSocket is passed to asyncio ↵Andrew Svetlov2019-12-071-0/+10
| | | | | | | | functions (GH-16457) (#17496) https://bugs.python.org/issue37404 (cherry picked from commit 892f9e0777f262d366d4747a54c33a1c15a49da6) Co-authored-by: idomic <michael.ido@gmail.com>
* bpo-38529: Fix asyncio stream warning (GH-17474)Miss Islington (bot)2019-12-071-18/+1
| | | | | (cherry picked from commit 7ddcd0caa4c2e6b43265df144f59c5aa508a94f2) Co-authored-by: Andrew Svetlov <andrew.svetlov@gmail.com>
* bpo-38785: Prevent asyncio from crashing (GH-17144)Miss Islington (bot)2019-11-131-1/+4
| | | | | | | | if parent `__init__` is not called from a constructor of object derived from `asyncio.Future` https://bugs.python.org/issue38785 (cherry picked from commit dad6be5ffe48beb74fad78cf758b886afddc7aed) Co-authored-by: Andrew Svetlov <andrew.svetlov@gmail.com>
* bpo-34679: ProactorEventLoop only uses set_wakeup_fd() in main thread (GH-16901)Miss Skeleton (bot)2019-10-231-3/+3
| | | | | | | bpo-34679, bpo-38563: asyncio.ProactorEventLoop.close() now only calls signal.set_wakeup_fd() in the main thread. (cherry picked from commit 1b53a24fb4417c764dd5933bce505f5c94249ca6) Co-authored-by: Victor Stinner <vstinner@python.org>
* bpo-34344 Fix AbstractEventLoopPolicy.get_event_loop docstring (GH-16463)Miss Islington (bot)2019-10-031-2/+2
| | | | | (cherry picked from commit b23a8423a923077e4f83d3f328bb7542b4c940ed) Co-authored-by: idomic <michael.ido@gmail.com>
* Fix and improve `asyncio.run()` docs (GH-16403) (GH-16504)Miss Islington (bot)2019-10-011-5/+1
| | | | | (cherry picked from commit e407013089259e4c0b271703e1975bbcd578a2d5) Co-authored-by: Kyle Stanley <aeros167@gmail.com>
* bpo-38242: Revert "bpo-36889: Merge asyncio streams (GH-13251)" (#16482) ↵Yury Selivanov2019-09-303-1242/+112
| | | | | (#16485) See https://bugs.python.org/issue38242 for more details
* bpo-38019: correctly handle pause/resume reading of closed asyncio unix pipe ↵Miss Islington (bot)2019-09-291-0/+11
| | | | | | | (GH-16472) (cherry picked from commit 58498bc7178608b1ab031994ca09c43889ce3e76) Co-authored-by: Andrew Svetlov <andrew.svetlov@gmail.com>
* bpo-38248: Fix inconsistent immediate asyncio.Task cancellation (GH-16330) ↵Miss Islington (bot)2019-09-251-1/+1
| | | | | | | (GH-16383) (cherry picked from commit edad4d89e357c92f70c0324b937845d652b20afd) Co-authored-by: Yury Selivanov <yury@edgedb.com>
* bpo-38260: Add Docs on asyncio.run (GH-16337)Miss Islington (bot)2019-09-251-0/+4
| | | | | | | | | | Add docs about return and raise exception on asyncio.run https://bugs.python.org/issue38260 Automerge-Triggered-By: @asvetlov (cherry picked from commit 17deb16883fa574a86e42551cc37f044182347ad) Co-authored-by: Emmanuel Arias <emmanuelarias30@gmail.com>
* [3.8] bpo-38148: Add slots to asyncio transports (GH-16077) (GH-16093)Andrew Svetlov2019-09-131-0/+14
| | | | | | | | | | * bpo-38148: Add slots to asyncio transports * Update Misc/NEWS.d/next/Library/2019-09-13-08-55-43.bpo-38148.Lnww6D.rst Co-Authored-By: Kyle Stanley <aeros167@gmail.com> (cherry picked from commit 9eb35ab0d71a6bd680e84fa0f828cb634e72b681) Co-authored-by: Andrew Svetlov <andrew.svetlov@gmail.com>
* bpo-36889: Document Stream class and add docstrings (GH-14488)Miss Islington (bot)2019-09-131-0/+21
| | | | | | | | | | | * This just copies the docs from `StreamWriter` and `StreamReader`. * Add docstring for asyncio functions. https://bugs.python.org/issue36889 Automerge-Triggered-By: @asvetlov (cherry picked from commit d31b31516c71890e8735606aec1dbf2bfb8fd6be) Co-authored-by: Xtreak <tir.karthi@gmail.com>
* bpo-36373: Deprecate explicit loop in task and subprocess API (GH-16033)Miss Islington (bot)2019-09-122-2/+30
| | | | | (cherry picked from commit a488879cbaf4b8b52699cadccf73bb4c271bcb29) Co-authored-by: Andrew Svetlov <andrew.svetlov@gmail.com>
* [3.8] bpo-36373: Fix deprecation warnings (GH-15889) (GH-15901)Andrew Svetlov2019-09-112-2/+2
| | | | | | https://bugs.python.org/issue36373 (cherry picked from commit 7264e92b718d307cc499b2f10eab7644b00f0499) Co-authored-by: Andrew Svetlov <andrew.svetlov@gmail.com>
* bpo-38066: Hide internal Stream methods (GH-15762)Miss Islington (bot)2019-09-102-11/+48
| | | | | | | | feed_eof(), feed_data(), set_exception(), and set_transport() are prefixed with underscore now. https://bugs.python.org/issue38066 (cherry picked from commit 12c122ae958a55c9874ed4c7d7805ceb084411d7) Co-authored-by: Andrew Svetlov <andrew.svetlov@gmail.com>
* bpo-36373: Deprecate explicit loop parameter in all public asyncio APIs ↵Miss Islington (bot)2019-09-101-0/+4
| | | | | | | | | | | | | | [queue] (GH-13950) This PR deprecate explicit loop parameters in all public asyncio APIs This issues is split to be easier to review. fourth step: queue.py https://bugs.python.org/issue36373 (cherry picked from commit 9008be303a89bfab8c3314c6a42330b5523adc8b) Co-authored-by: Emmanuel Arias <emmanuelarias30@gmail.com>
* bpo-36373: Deprecate explicit loop parameter in all public asyncio APIs ↵Miss Islington (bot)2019-09-101-12/+29
| | | | | | | | | | | | | | [locks] (GH-13920) This PR deprecate explicit loop parameters in all public asyncio APIs This issues is split to be easier to review. Third step: locks.py https://bugs.python.org/issue36373 (cherry picked from commit 537877d85d1c27d2c2f5189e39da64a7a0c413d3) Co-authored-by: Emmanuel Arias <emmanuelarias30@gmail.com>
* Fix typos mostly in comments, docs and test names (GH-15209)Miss Islington (bot)2019-08-301-2/+2
| | | | | (cherry picked from commit 39d87b54715197ca9dcb6902bb43461c0ed701a2) Co-authored-by: Min ho Kim <minho42@gmail.com>
* bpo-34679: Restore instantiation Windows IOCP event loop from non-main ↵Miss Islington (bot)2019-08-261-1/+4
| | | | | | | | | | thread (GH-15492) * Restore running proactor event loop from non-main thread Co-Authored-By: Kyle Stanley <aeros167@gmail.com> (cherry picked from commit 1c0600998681295735a18690fae184b0c9a4ca51) Co-authored-by: Andrew Svetlov <andrew.svetlov@gmail.com>
* [3.8] Fix typos in docs, comments and test assert messages (GH-14872). (#14900)Kyle Stanley2019-07-221-1/+1
| | | | | (cherry picked from commit 96e12d5f4f3c5a20986566038ee763dff3c228a1) Co-authored-by: Min ho Kim <minho42@gmail.com>
* bpo-35621: Support running subprocesses in asyncio when loop is executed in ↵Miss Islington (bot)2019-06-301-29/+244
| | | | | | | non-main thread (GH-14344) (cherry picked from commit 0d671c04c39b52e44597491b893eb0b6c86b3d45) Co-authored-by: Andrew Svetlov <andrew.svetlov@gmail.com>
* Replace deprecation warning with RuntimeError (GH-14397)Miss Islington (bot)2019-06-271-4/+2
| | | | | (cherry picked from commit 97d15b1ee06ce80c4dbda91fb538a89bbcb2bed9) Co-authored-by: Andrew Svetlov <andrew.svetlov@gmail.com>
* [3.8] Use threadpool for reading from file in sendfile fallback mode ↵Andrew Svetlov2019-06-151-1/+1
| | | | | | | (GH-14076) (GH-14102) (cherry picked from commit 0237265e8287141c40faa8719da3a2d21d511d0d) Co-authored-by: Andrew Svetlov <andrew.svetlov@gmail.com>
* bpo-37279: Fix asyncio sendfile support when extra data are sent in ↵Miss Islington (bot)2019-06-151-2/+2
| | | | | | | fallback mode. (GH-14075) (cherry picked from commit ef2152354f03a165c5e3adb53e2276934fabd50a) Co-authored-by: Andrew Svetlov <andrew.svetlov@gmail.com>
* bpo-36607: Eliminate RuntimeError raised by asyncio.all_tasks() (GH-13971)Miss Islington (bot)2019-06-111-6/+32
| | | | | | | | If internal tasks weak set is changed by another thread during iteration. https://bugs.python.org/issue36607 (cherry picked from commit 65aa64fae89a24491aae84ba0329eb8f3c68c389) Co-authored-by: Andrew Svetlov <andrew.svetlov@gmail.com>
* bpo-34767: Do not always create a collections.deque() in asyncio.Lock() ↵Miss Islington (bot)2019-06-051-2/+7
| | | | | | | | (GH-13834) https://bugs.python.org/issue34767 (cherry picked from commit 9aa78566fbeeb8cdaa669ad22f92cf63765f4135) Co-authored-by: Zackery Spytz <zspytz@gmail.com>
* bpo-36373: Deprecate explicit loop parameter in all public asyncio APIs ↵Miss Islington (bot)2019-06-051-0/+16
| | | | | | | | | | | | | | [streams] (GH-13671) This PR deprecate explicit loop parameters in all public asyncio APIs This issues is split to be easier to review. Second step: streams.py https://bugs.python.org/issue36373 (cherry picked from commit 6d64a8f49eb321116f585c4b036c81bb976d2d5c) Co-authored-by: Emmanuel Arias <emmanuelarias30@gmail.com>
* Revert "bpo-34037, asyncio: add BaseEventLoop.wait_executor_on_close ↵Łukasz Langa2019-06-041-3/+1
| | | | | (GH-13786)" (#13802) This reverts commit 0f0a30f4da4b529e0f7df857b9f575b231b32758.