summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_asyncio
Commit message (Collapse)AuthorAgeFilesLines
* gh-128002: add more thread safety tests for asyncio (#128480)Kumar Aditya2025-01-131-0/+54
|
* gh-128552: fix refcycles in eager task creation (#128553)Thomas Grainger2025-01-071-4/+58
|
* gh-128340: add thread safe handle for `loop.call_soon_threadsafe` (#128369)Kumar Aditya2025-01-061-0/+118
| | | Adds `_ThreadSafeHandle` to be used for callbacks scheduled with `loop.call_soon_threadsafe`.
* gh-128002: fix many thread safety issues in asyncio (#128147)Kumar Aditya2025-01-041-0/+82
| | | | | | * Makes `_asyncio.Task` and `_asyncio.Future` thread-safe by adding critical sections * Add assertions to check for thread safety checking locking of object by critical sections in internal functions * Make `_asyncio.all_tasks` thread safe when eager tasks are used * Add a thread safety test
* gh-127529: Correct asyncio's `accept_connection` behaviour for handling ↵jb21702025-01-031-0/+25
| | | | | `ConnectionAbortedError` (#127532) Co-authored-by: Kumar Aditya <kumaraditya@python.org>
* gh-127949: deprecate `asyncio.set_event_loop` (#128218)Kumar Aditya2024-12-248-37/+45
| | | Deprecate `asyncio.set_event_loop` to be removed in Python 3.16.
* gh-127949: deprecate asyncio policy classes (#128216)Kumar Aditya2024-12-243-19/+35
|
* gh-127949: fix resource warnings in `test_tasks.py` (#128172)Thomas Grainger2024-12-221-8/+8
|
* gh-127949: deprecate `asyncio.get_event_loop_policy` (#128053)Kumar Aditya2024-12-184-18/+24
| | | This deprecates `asyncio.get_event_loop_policy` and will be removed in Python 3.16.
* gh-127949: deprecate `asyncio.set_event_loop_policy` (#128024)Kumar Aditya2024-12-1831-46/+50
| | | | First step towards deprecating the asyncio policy system. This deprecates `asyncio.set_event_loop_policy` and will be removed in Python 3.16.
* gh-127655: Ensure `_SelectorSocketTransport.writelines` pauses the protocol ↵J. Nick Koston2024-12-061-0/+12
| | | | | | | if needed (#127656) Ensure `_SelectorSocketTransport.writelines` pauses the protocol if it reaches the high water mark as needed. Co-authored-by: Kumar Aditya <kumaraditya@python.org>
* gh-127258: Fix asyncio test_staggered_race_with_eager_tasks() (#127358)Victor Stinner2024-11-291-1/+5
| | | Replace the sleep(2) with a task which is blocked forever.
* gh-126353: remove implicit creation of loop from `asyncio.get_event_loop` ↵Kumar Aditya2024-11-042-29/+11
| | | | | (#126354) Remove implicit creation of loop from `asyncio.get_event_loop`. This is a step forward of deprecating the policy system of asyncio.
* gh-126083: Fix a reference leak in `asyncio.Task` when reinitializing with ↵Nico-Posada2024-10-311-0/+22
| | | | new non-`None` context (#126103)
* gh-125966: fix use-after-free on `fut->fut_callback0` due to an evil ↵Bénédikt Tran2024-10-271-0/+18
| | | | callback's `__eq__` in asyncio (#125967)
* gh-125984: fix use-after-free on `fut->fut_{callback,context}0` due to an ↵Bénédikt Tran2024-10-271-2/+71
| | | | evil `loop.__getattribute__` (#126003)
* gh-125969: fix OOB in `future_schedule_callbacks` due to an evil `call_soon` ↵Bénédikt Tran2024-10-251-0/+33
| | | | | (#125970) Co-authored-by: Andrew Svetlov <andrew.svetlov@gmail.com>
* GH-125789: fix `fut._callbacks` to always return a copy of callbacks (#125922)Kumar Aditya2024-10-251-0/+18
| | | Fix `asyncio.Future._callbacks` to always return a copy of the internal list of callbacks to avoid mutation from user code affecting the internal state.
* gh-118950: Fix SSLProtocol.connection_lost not being called when OSError is ↵Javad Shafique2024-10-241-0/+48
| | | | | | | thrown (#118960) Co-authored-by: Kumar Aditya <kumaraditya@python.org>
* gh-124958: Revert "gh-125472: Revert "gh-124958: fix asyncio.TaskGroup and ↵Thomas Grainger2024-10-142-2/+122
| | | | | | | | | _PyFuture refcycles ... (#125486) * Revert "gh-125472: Revert "gh-124958: fix asyncio.TaskGroup and _PyFuture refcycles (#12… (#125476)" This reverts commit e99650b80ace3893c2a80b3f2a4aca99cb305191. * fix incompatability with gh-124392
* gh-125472: Revert "gh-124958: fix asyncio.TaskGroup and _PyFuture refcycles ↵Kirill Podoprigora2024-10-142-112/+2
| | | | | | | (#12… (#125476) Revert "gh-124958: fix asyncio.TaskGroup and _PyFuture refcycles (#124959)" This reverts commit d5dbbf4372cd3dbf3eead1cc70ddc4261c061fd9.
* gh-124958: fix asyncio.TaskGroup and _PyFuture refcycles (#124959)Thomas Grainger2024-10-142-2/+112
|
* gh-124309: fix staggered race on eager tasks (#124847)Thomas Grainger2024-10-112-0/+73
| | | | | | | This patch is entirely by Thomas and Peter Co-authored-by: Thomas Grainger <tagrain@gmail.com> Co-authored-by: Peter Bierma <zintensitydev@gmail.com>
* GH-119866: Spill the stack around escaping calls. (GH-124392)Mark Shannon2024-10-071-3/+3
| | | | | | | * Spill the evaluation around escaping calls in the generated interpreter and JIT. * The code generator tracks live, cached values so they can be saved to memory when needed. * Spills the stack pointer around escaping calls, so that the exact stack is visible to the cycle GC.
* gh-124858: fix happy eyeballs refcyles (#124859)Thomas Grainger2024-10-021-0/+18
|
* gh-124309: Revert eager task factory fix to prevent breaking downstream ↵Peter Bierma2024-10-012-99/+4
| | | | | | | | | | | (#124810) * Revert "GH-124639: add back loop param to staggered_race (#124700)" This reverts commit e0a41a5dd12cb6e9277b05abebac5c70be684dd7. * Revert "gh-124309: Modernize the `staggered_race` implementation to support eager task factories (#124390)" This reverts commit de929f353c413459834a2a37b2d9b0240673d874.
* GH-124639: add back loop param to staggered_race (#124700)Kumar Aditya2024-09-291-0/+19
|
* gh-120284: Enhance `asyncio.run` to accept awaitable objects (#120566)Ron Frederick2024-09-261-10/+19
| | | | Co-authored-by: Kumar Aditya <kumaraditya@python.org>
* gh-124309: Modernize the `staggered_race` implementation to support eager ↵Peter Bierma2024-09-262-4/+80
| | | | | | | | task factories (#124390) Co-authored-by: Thomas Grainger <tagrain@gmail.com> Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com> Co-authored-by: Carol Willing <carolcode@willingconsulting.com> Co-authored-by: Kumar Aditya <kumaraditya@python.org>
* gh-119400: make_ssl_certs: update reference test data automatically, pass ↵Alexander Kanavin2024-09-251-18/+3
| | | | | | | | | | | | | | | | | | | in expiration dates as parameters #119400 (GH-119401) * Lib/test/certdata: do not hardcode reference cert data into tests The script was simply printing the reference data and asking users to update it by hand into the test suites. This can be easily improved by writing the data into files and having the test cases load the files. * make_ssl_certs: make it possible to pass in expiration dates from command line Note that in this commit, the defaults are same as they were, so if nothing is specified the script works as before. --------- Signed-off-by: Alexander Kanavin <alex.kanavin@gmail.com>
* gh-122957: Fix test flakiness in asyncio test in free-thread build (#124039)Loïc Estève2024-09-131-2/+4
|
* gh-122136: test_asyncio: Don't fail if the kernel buffers more data than ↵Petr Viktorin2024-08-281-5/+13
| | | | advertised (GH-123423)
* Fix typos in comments (#123201)Wulian2024-08-211-1/+1
|
* Fix typos in comments and test code (#122846)Xie Yanbo2024-08-122-4/+4
|
* gh-122858: Deprecate `asyncio.iscoroutinefunction` (#122875)Wulian2024-08-112-2/+5
| | | | | Deprecate `asyncio.iscoroutinefunction` in favor of `inspect.iscoroutinefunction`. Co-authored-by: Kumar Aditya <kumaraditya@python.org>
* gh-122332: Fix missing `NULL` check in `asyncio.Task.get_coro` (#122338)Peter Bierma2024-07-271-0/+12
|
* gh-122187: Avoid TSan reported race in `run_udp_echo_server` (#122189)Sam Gross2024-07-251-2/+7
| | | | | TSan doesn't fully recognize the synchronization via I/O, so ensure that socket name is retrieved earlier and use a different socket for sending the "STOP" message.
* gh-117657: Skip tests that use threads after fork (#122194)Sam Gross2024-07-231-0/+3
| | | | These tests fail when run under thread sanitizer due to the use of fork and threads.
* gh-87744: fix waitpid race while calling send_signal in asyncio (#121126)Kumar Aditya2024-07-011-0/+15
| | | asyncio earlier relied on subprocess module to send signals to the process, this has some drawbacks one being that subprocess module unnecessarily calls waitpid on child processes and hence it races with asyncio implementation which internally uses child watchers. To mitigate this, now asyncio sends signals directly to the process without going through the subprocess on non windows systems. On Windows it fallbacks to subprocess module handling but on windows there are no child watchers so this issue doesn't exists altogether.
* gh-121025: Improve partialmethod.__repr__ (GH-121033)Bénédikt Tran2024-06-261-1/+1
| | | It no longer contains redundant commas and spaces.
* GH-120804: Remove `PidfdChildWatcher`, `ThreadedChildWatcher` and ↵Kumar Aditya2024-06-234-83/+16
| | | | `AbstractChildWatcher` from asyncio APIs (#120893)
* GH-120804: Remove `get_child_watcher` and `set_child_watcher` from asyncio ↵Kumar Aditya2024-06-234-114/+13
| | | | (#120818)
* GH-107803: double linked list implementation for asyncio tasks (GH-107804)Kumar Aditya2024-06-221-11/+23
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * linked list * add tail optmiization to linked list * wip * wip * wip * more fixes * finally it works * add tests * remove weakreflist * add some comments * reduce code duplication in _asynciomodule.c * address some review comments * add invariants about the state of the linked list * add better explanation * clinic regen * reorder branches for better branch prediction * Update Modules/_asynciomodule.c * Apply suggestions from code review Co-authored-by: Itamar Oren <itamarost@gmail.com> * fix capturing of eager tasks * add comment to task finalization * fix tests and couple c implmentation to c task improved linked-list logic and more comments * fix test --------- Co-authored-by: Itamar Oren <itamarost@gmail.com>
* GH-120804: Remove SafeChildWatcher, FastChildWatcher and ↵Kumar Aditya2024-06-214-719/+1
| | | | | MultiLoopChildWatcher from asyncio (#120805) Remove SafeChildWatcher, FastChildWatcher and MultiLoopChildWatcher from asyncio. These child watchers have been deprecated since Python 3.12. The tests are also removed and some more tests will be added after the rewrite of child watchers.
* gh-120417: Add #noqa: F401 to tests (#120627)Victor Stinner2024-06-181-4/+4
| | | | Ignore linter "imported but unused" warnings in tests when the linter doesn't understand how the import is used.
* gh-114091: Reword error message for unawaitable types (#114090)Steele Farnsworth2024-06-172-5/+5
| | | | | Reword error message for unawaitable types.
* gh-120226: Fix test_sendfile_close_peer_in_the_middle_of_receiving on Linux ↵Xi Ruoyao2024-06-071-7/+4
| | | | | >= 6.10 (#120227) The worst case is that the kernel buffers 17 pages with a page size of 64k.
* gh-113892: Add a extra check to `ProactorEventLoop.sock_connect` to ensure ↵Kirill Podoprigora2024-06-011-2/+7
| | | | that the given socket is in non-blocking mode (#119519)
* Remove almost all unpaired backticks in docstrings (#119231)Geoffrey Thomas2024-05-221-2/+2
| | | | | | | | | | | | | | | | | | As reported in #117847 and #115366, an unpaired backtick in a docstring tends to confuse e.g. Sphinx running on subclasses of standard library objects, and the typographic style of using a backtick as an opening quote is no longer in favor. Convert almost all uses of the form The variable `foo' should do xyz to The variable 'foo' should do xyz and also fix up miscellaneous other unpaired backticks (extraneous / missing characters). No functional change is intended here other than in human-readable docstrings.
* gh-119121: Fix and test `async.staggered.staggered_race` (#119173)Nikita Sobolev2024-05-201-0/+97
|