aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/Lib/test/test_asyncio
Commit message (Collapse)AuthorAge
* gh-87744: fix waitpid race while calling send_signal in asyncio (#121126)Kumar Aditya2024-07-01
| | | 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-26
| | | It no longer contains redundant commas and spaces.
* GH-120804: Remove `PidfdChildWatcher`, `ThreadedChildWatcher` and ↵Kumar Aditya2024-06-23
| | | | `AbstractChildWatcher` from asyncio APIs (#120893)
* GH-120804: Remove `get_child_watcher` and `set_child_watcher` from asyncio ↵Kumar Aditya2024-06-23
| | | | (#120818)
* GH-107803: double linked list implementation for asyncio tasks (GH-107804)Kumar Aditya2024-06-22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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-21
| | | | | 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-18
| | | | 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-17
| | | | | Reword error message for unawaitable types.
* gh-120226: Fix test_sendfile_close_peer_in_the_middle_of_receiving on Linux ↵Xi Ruoyao2024-06-07
| | | | | >= 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-01
| | | | that the given socket is in non-blocking mode (#119519)
* Remove almost all unpaired backticks in docstrings (#119231)Geoffrey Thomas2024-05-22
| | | | | | | | | | | | | | | | | | 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-20
|
* gh-119064: Use os_helper.FakePath instead of pathlib.Path in tests (GH-119065)Serhiy Storchaka2024-05-16
|
* gh-117722: Fix Stream.readuntil with non-bytes buffer objects (#117723)Bruce Merry2024-04-11
| | | | | | | | | | | | | gh-16429 introduced support for an iterable of separators in Stream.readuntil. Since bytes-like types are themselves iterable, this can introduce ambiguities in deciding whether the argument is an iterator of separators or a singleton separator. In gh-16429, only 'bytes' was considered a singleton, but this will break code that passes other buffer object types. Fix it by only supporting tuples rather than arbitrary iterables. Closes gh-117722.
* gh-116720: Fix corner cases of taskgroups (#117407)Guido van Rossum2024-04-09
| | | | | | | | | | This prevents external cancellations of a task group's parent task to be dropped when an internal cancellation happens at the same time. Also strengthen the semantics of uncancel() to clear self._must_cancel when the cancellation count reaches zero. Co-Authored-By: Tin Tvrtković <tinchester@gmail.com> Co-Authored-By: Arthur Tacca
* gh-81322: support multiple separators in StreamReader.readuntil (#16429)Bruce Merry2024-04-08
|
* gh-96471: Add asyncio queue shutdown (#104228)Laurie O2024-04-06
| | | Co-authored-by: Duprat <yduprat@gmail.com>
* gh-117459: Keep the traceback in _convert_future_exc (#117460)rsp4jack2024-04-03
|
* gh-77714: Provide an async iterator version of as_completed (GH-22491)Justin Turner Arthur2024-04-01
| | | | | | | | | * as_completed returns object that is both iterator and async iterator * Existing tests adjusted to test both the old and new style * New test to ensure iterator can be resumed * New test to ensure async iterator yields any passed-in Futures as-is Co-authored-by: Serhiy Storchaka <storchaka@gmail.com> Co-authored-by: Guido van Rossum <gvanrossum@gmail.com>
* gh-71042: Add `platform.android_ver` (#116674)Malcolm Smith2024-03-27
|
* gh-91227: Ignore ERROR_PORT_UNREACHABLE in proactor recvfrom() (#32011)Erik Soma2024-03-23
|
* gh-116333: Relax error string text expectations in SSL-related tests (GH-116334)Will Childs-Klein2024-03-21
| | | | | | | | | | | | | | | | | | | * Relax error string text expectations in SSL-related tests As suggested [here][1], this change relaxes the OpenSSL error string text expectations in a number of tests. This was specifically done in support of more easily building CPython [AWS-LC][2], but because AWS-LC is a fork of [BoringSSL][3], it should increase compatibility with that library as well. In addition to the error string relaxations, we also add some guards around the `tls-unique` channel binding being used with TLSv1.3, as that feature (described in [RFC 6929][4]) is [not defined][5] for TLSv1.3. [1]: https://discuss.python.org/t/support-building-ssl-and-hashlib-modules-against-aws-lc/44505/4 [2]: https://github.com/aws/aws-lc [3]: https://github.com/google/boringssl [4]: https://datatracker.ietf.org/doc/html/rfc5929#section-3 [5]: https://datatracker.ietf.org/doc/html/rfc8446#appendix-C.5
* gh-116773: Ensure overlapped objects on Windows are not deallocated too ↵jkriegshauser2024-03-20
| | | | early by asyncio (GH-116774)
* gh-113538: Add asycio.Server.{close,abort}_clients (redo) (#116784)Pierre Ossman (ThinLinc team)2024-03-18
| | | | | | | These give applications the option of more forcefully terminating client connections for asyncio servers. Useful when terminating a service and there is limited time to wait for clients to finish up their work. This is a do-over with a test fix for gh-114432, which was reverted.
* gh-113538: Revert "gh-113538: Add asycio.Server.{close,abort}_clients ↵Guido van Rossum2024-03-12
| | | | | | | | | | (#114432)" (#116632) Revert "gh-113538: Add asycio.Server.{close,abort}_clients (#114432)" Reason: The new test doesn't always pass: https://github.com/python/cpython/pull/116423#issuecomment-1989425489 This reverts commit 1d0d49a7e86257ff95b4de0685e6997d7533993c.
* gh-113538: Add asycio.Server.{close,abort}_clients (#114432)Pierre Ossman (ThinLinc team)2024-03-11
| | | | | | These give applications the option of more forcefully terminating client connections for asyncio servers. Useful when terminating a service and there is limited time to wait for clients to finish up their work.
* gh-71052: Change Android's `sys.platform` from "linux" to "android"Malcolm Smith2024-03-11
| | | | Co-authored-by: Erlend E. Aasland <erlend.aasland@protonmail.com>
* gh-115957: Close coroutine if TaskGroup.create_task() raises an error (#116009)Jason Zhang2024-03-06
|
* gh-116112: Fix `ResourceWarning` in `test_asyncio.test_stream` (#116371)Nikita Sobolev2024-03-06
| | | Co-authored-by: @CendioOssman
* chore: fix typos (#116345)cui fliter2024-03-05
| | | Signed-off-by: cui fliter <imcusg@gmail.com>
* gh-71052: Add test exclusions to support running the test suite on Android ↵Malcolm Smith2024-02-29
| | | | (#115918)
* gh-112997: Don't log arguments in asyncio unless debugging (#115667)Pierre Ossman (ThinLinc team)2024-02-27
| | | | | | Nothing else in Python generally logs the contents of variables, so this can be very unexpected for developers and could leak sensitive information in to terminals and log files.
* gh-114914: Avoid keeping dead StreamWriter alive (#115661)Pierre Ossman (ThinLinc team)2024-02-27
| | | | | | | | | | In some cases we might cause a StreamWriter to stay alive even when the application has dropped all references to it. This prevents us from doing automatical cleanup, and complaining that the StreamWriter wasn't properly closed. Fortunately, the extra reference was never actually used for anything so we can just drop it.
* gh-111358: Fix timeout behaviour in BaseEventLoop.shutdown_default_executor ↵Jamie Phan2024-02-19
| | | | (#115622)
* gh-113812: Allow DatagramTransport.sendto to send empty data (#115199)Jamie Phan2024-02-16
| | | | Also include the UDP packet header sizes (8 bytes per packet) in the buffer size reported to the flow control subsystem.
* gh-114099: Add test exclusions to support running the test suite on iOS ↵Russell Keith-Magee2024-02-05
| | | | | | | | | | | | | (#114889) Add test annotations required to run the test suite on iOS (PEP 730). The majority of the change involve annotating tests that use subprocess, but are skipped on Emscripten/WASI for other reasons, and including iOS/tvOS/watchOS under the same umbrella as macOS/darwin checks. `is_apple` and `is_apple_mobile` test helpers have been added to identify *any* Apple platform, and "any Apple platform except macOS", respectively.
* gh-114887 Reject only sockets of type SOCK_STREAM in ↵Travis Howse2024-02-03
| | | | | | | create_datagram_endpoint() (#114893) Also improve exception message. Co-authored-by: Donghee Na <donghee.na92@gmail.com>
* gh-112202: Ensure that condition.notify() succeeds even when racing with ↵Kristján Valur Jónsson2024-02-03
| | | | | Task.cancel() (#112201) Also did a general cleanup of asyncio locks.py comments and docstrings.
* gh-114272: Fix or skip tests that fail due to spaces in paths (GH-114451)Steve Dower2024-01-25
|
* gh-109862: Fix test_create_subprocess_with_pidfd when it was run separately ↵Serhiy Storchaka2024-01-15
| | | | (GH-113991)
* gh-95649: Document that asyncio contains uvloop code (#107536)Alois Klink2024-01-12
| | | | | | | | Some of the asyncio SSL changes in GH-31275 [1] were taken from v0.16.0 of the uvloop project [2]. In order to comply with the MIT license, we need to just need to document the copyright information. [1]: https://github.com/python/cpython/pull/31275 [2]: https://github.com/MagicStack/uvloop/tree/v0.16.0
* gh-96037: Always insert TimeoutError when exit an expired asyncio.timeout() ↵Serhiy Storchaka2024-01-10
| | | | | | | | block (GH-113819) If other exception was raised during exiting an expired asyncio.timeout() block, insert TimeoutError in the exception context just above the CancelledError.
* gh-113879: Fix ResourceWarning in test_asyncio.test_server (GH-113881)Serhiy Storchaka2024-01-10
|
* gh-112182: Replace StopIteration with RuntimeError for future (#113220)Jamie Phan2024-01-09
| | | | | | When an `StopIteration` raises into `asyncio.Future`, this will cause a thread to hang. This commit address this by not raising an exception and silently transforming the `StopIteration` with a `RuntimeError`, which the caller can reconstruct from `fut.exception().__cause__`
* GH-111693: Propagate correct asyncio.CancelledError instance out of ↵Kristján Valur Jónsson2024-01-08
| | | | | asyncio.Condition.wait() (#111694) Also fix a race condition in `asyncio.Semaphore.acquire()` when cancelled.
* gh-113538: Don't error in stream reader protocol callback when task is ↵Guido van Rossum2024-01-04
| | | | cancelled (#113690)
* gh-112559: Avoid unnecessary conversion attempts to enum_klass in signal.py ↵Yilei Yang2023-12-23
| | | | (#113040)
* GH-113214: Fix SSLProto exception handling in SSL-over-SSL scenarios (#113334)Martijn Pieters2023-12-20
| | | | | | When wrapped, `_SSLProtocolTransport._force_close(exc)` is called just like in the unwrapped scenario `_SelectorTransport._force_close(exc)` or `_ProactorBasePipeTransport._force_close(exc)` would be called, except here the exception needs to be passed through the `SSLProtocol._abort()` method, which didn't accept an exception object. This commit ensures that this path works, in the same way that the uvloop implementation of SSLProto passes on the exception (on which the current implementation of SSLProto is based).
* gh-112186: Improve test case `test_loop_is_closed_resource_warnings` (#112187)DPR2023-11-19
|
* gh-109538: Avoid RuntimeError when StreamWriter is deleted with closed loop ↵DPR2023-11-15
| | | | | | | (#111983) Issue a ResourceWarning instead. Co-authored-by: Hugo van Kemenade <hugovk@users.noreply.github.com>