summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_asyncio
Commit message (Collapse)AuthorAgeFilesLines
* [3.13] gh-115514: Fix incomplete writes after close while using ssl in ↵Miss Islington (bot)2025-02-022-0/+203
| | | | | | | | | | asyncio(GH-128037) (#129581) gh-115514: Fix incomplete writes after close while using ssl in asyncio(GH-128037) (cherry picked from commit 4e38eeafe2ff3bfc686514731d6281fed34a435e) Co-authored-by: Vojtěch Boček <vbocek@gmail.com> Co-authored-by: Kumar Aditya <kumaraditya@python.org>
* [3.13] gh-128479: fix asyncio staggered race leaking tasks, and logging ↵Miss Islington (bot)2025-01-231-0/+27
| | | | | | | | | unhandled exception.append exception (GH-128475) (#129227) gh-128479: fix asyncio staggered race leaking tasks, and logging unhandled exception.append exception (GH-128475) (cherry picked from commit ec91e1c2762412f1408b0dfb5d281873b852affe) Co-authored-by: Thomas Grainger <tagrain@gmail.com> Co-authored-by: Peter Bierma <zintensitydev@gmail.com>
* [3.13] gh-128588: gh-128550: remove eager tasks optimization that missed and ↵Miss Islington (bot)2025-01-201-0/+50
| | | | | | | | | introduced incorrect cancellations (GH-129063) (#129089) gh-128588: gh-128550: remove eager tasks optimization that missed and introduced incorrect cancellations (GH-129063) (cherry picked from commit ed6934e71e55d398df8263f4697f58e4a3815f69) Co-authored-by: Thomas Grainger <tagrain@gmail.com> Co-authored-by: Kumar Aditya <kumaraditya@python.org>
* [3.13] gh-128552: fix refcycles in eager task creation (#128553) (#128585)Thomas Grainger2025-01-081-4/+59
| | | | | gh-128552: fix refcycles in eager task creation (#128553) (cherry picked from commit 61b9811ac6843e22b5896ef96030d421b79cd892)
* [3.13] gh-127655: Ensure `_SelectorSocketTransport.writelines` pauses the ↵Miss Islington (bot)2024-12-061-0/+12
| | | | | | | | | | | protocol if needed (GH-127656) (#127663) gh-127655: Ensure `_SelectorSocketTransport.writelines` pauses the protocol if needed (GH-127656) Ensure `_SelectorSocketTransport.writelines` pauses the protocol if it reaches the high water mark as needed. (cherry picked from commit e991ac8f2037d78140e417cc9a9486223eb3e786) Co-authored-by: J. Nick Koston <nick@koston.org> Co-authored-by: Kumar Aditya <kumaraditya@python.org>
* [3.13] gh-127258: Fix asyncio test_staggered_race_with_eager_tasks() ↵Miss Islington (bot)2024-11-291-1/+5
| | | | | | | | | | (GH-127358) (#127401) gh-127258: Fix asyncio test_staggered_race_with_eager_tasks() (GH-127358) Replace the sleep(2) with a task which is blocked forever. (cherry picked from commit bfabf96b50b7d6a9c15b298a86ba3633b05a1fd7) Co-authored-by: Victor Stinner <vstinner@python.org>
* [3.13] gh-126083: Fix a reference leak in `asyncio.Task` when reinitializing ↵Miss Islington (bot)2024-10-311-0/+22
| | | | | | | | with new non-`None` context (GH-126103) (#126229) gh-126083: Fix a reference leak in `asyncio.Task` when reinitializing with new non-`None` context (GH-126103) (cherry picked from commit d07dcce6935364cab807e0df931ed09b088ade69) Co-authored-by: Nico-Posada <102486290+Nico-Posada@users.noreply.github.com>
* [3.13] gh-125966: fix use-after-free on `fut->fut_callback0` due to an evil ↵Miss Islington (bot)2024-10-271-0/+18
| | | | | | | | callback's `__eq__` in asyncio (GH-125967) (#126047) gh-125966: fix use-after-free on `fut->fut_callback0` due to an evil callback's `__eq__` in asyncio (GH-125967) (cherry picked from commit ed5059eeb1aa50b481957307db5a34b937497382) Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
* [3.13] gh-125984: fix use-after-free on `fut->fut_{callback,context}0` due ↵Miss Islington (bot)2024-10-271-2/+71
| | | | | | | | to an evil `loop.__getattribute__` (GH-126003) (#126043) gh-125984: fix use-after-free on `fut->fut_{callback,context}0` due to an evil `loop.__getattribute__` (GH-126003) (cherry picked from commit f819d4301d7c75f02be1187fda017f0e7b608816) Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
* [3.13] gh-118950: Fix SSLProtocol.connection_lost not being called when ↵Miss Islington (bot)2024-10-261-0/+48
| | | | | | | | | | OSError is thrown (GH-118960) (#125931) gh-118950: Fix SSLProtocol.connection_lost not being called when OSError is thrown (GH-118960) (cherry picked from commit 3f24bde0b6689b8f05872a8118a97908b5a94659) Co-authored-by: Javad Shafique <javadshafique@hotmail.com> Co-authored-by: Kumar Aditya <kumaraditya@python.org>
* [3.13] gh-125969: fix OOB in `future_schedule_callbacks` due to an evil ↵Miss Islington (bot)2024-10-251-0/+33
| | | | | | | | | `call_soon` (GH-125970) (#125991) gh-125969: fix OOB in `future_schedule_callbacks` due to an evil `call_soon` (GH-125970) (cherry picked from commit c5b99f5c2c5347d66b9da362773969c531fb6c85) Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com> Co-authored-by: Andrew Svetlov <andrew.svetlov@gmail.com>
* [3.13] GH-125789: fix `fut._callbacks` to always return a copy of callbacks ↵Kumar Aditya2024-10-251-0/+18
| | | | | | | | | (#125922) (#125976) GH-125789: fix `fut._callbacks` to always return a copy of callbacks (#125922) 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. (cherry picked from commit cae853e3b44cd5cb033b904e163c490dd28bc30a)
* [3.13] gh-124858: fix happy eyeballs refcyles (GH-124859) (#124912)Miss Islington (bot)2024-10-231-0/+18
| | | | | | gh-124858: fix happy eyeballs refcyles (GH-124859) (cherry picked from commit c066bf553577d1000e208eb078d9e758c3e41186) Co-authored-by: Thomas Grainger <tagrain@gmail.com>
* [3.13] gh-124958: fix asyncio.TaskGroup and _PyFuture refcycles (GH-124959) ↵Miss Islington (bot)2024-10-142-2/+112
| | | | | | | | (#125463) gh-124958: fix asyncio.TaskGroup and _PyFuture refcycles (GH-124959) (cherry picked from commit d5dbbf4372cd3dbf3eead1cc70ddc4261c061fd9) Co-authored-by: Thomas Grainger <tagrain@gmail.com>
* [3.13] gh-124309: fix staggered race on eager tasks (GH-124847) (#125339)Miss Islington (bot)2024-10-122-0/+73
| | | | Co-authored-by: Thomas Grainger <tagrain@gmail.com> Co-authored-by: Peter Bierma <zintensitydev@gmail.com>
* [3.13] gh-122957: Fix test flakiness in asyncio test in free-thread build ↵Miss Islington (bot)2024-09-231-2/+4
| | | | | | | | (GH-124039) (#124067) gh-122957: Fix test flakiness in asyncio test in free-thread build (GH-124039) (cherry picked from commit eadb9660ed836b40667d4f662eae90287ff18397) Co-authored-by: Loïc Estève <loic.esteve@ymail.com>
* [3.13] gh-120226: Fix test_sendfile_close_peer_in_the_middle_of_receiving on ↵Miss Islington (bot)2024-09-021-7/+4
| | | | | | | | | | Linux >= 6.10 (GH-120227) (#123421) gh-120226: Fix test_sendfile_close_peer_in_the_middle_of_receiving on Linux >= 6.10 (GH-120227) The worst case is that the kernel buffers 17 pages with a page size of 64k. (cherry picked from commit a7584245661102a5768c643fbd7db8395fd3c90e) Co-authored-by: Xi Ruoyao <xry111@xry111.site>
* [3.13] gh-122136: test_asyncio: Don't fail if the kernel buffers more data ↵Miss Islington (bot)2024-08-291-5/+13
| | | | | | | | than advertised (GH-123423) (#123443) gh-122136: test_asyncio: Don't fail if the kernel buffers more data than advertised (GH-123423) (cherry picked from commit b379f1b26c1e89c8e9160b4dede61b980cc77be6) Co-authored-by: Petr Viktorin <encukou@gmail.com>
* [3.13] gh-122695: Fix double-free when using `gc.get_referents` with a freed ↵Peter Bierma2024-08-091-0/+8
| | | | | `_asyncio.FutureIter` (#122837) * Backport #122834 for 3.13
* [3.13] gh-122332: Fix missing `NULL` check in `asyncio.Task.get_coro` ↵Miss Islington (bot)2024-07-271-0/+12
| | | | | | | | (GH-122338) (#122344) gh-122332: Fix missing `NULL` check in `asyncio.Task.get_coro` (GH-122338) (cherry picked from commit c08696286f52d286674f264eecf7b33a335a890b) Co-authored-by: Peter Bierma <zintensitydev@gmail.com>
* [3.13] gh-122187: Avoid TSan reported race in `run_udp_echo_server` ↵Miss Islington (bot)2024-07-251-2/+7
| | | | | | | | | | | | (GH-122189) (#122263) gh-122187: Avoid TSan reported race in `run_udp_echo_server` (GH-122189) 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. (cherry picked from commit 2f74b709b637cad7a9c18a2d90b0747823f2ff51) Co-authored-by: Sam Gross <colesbury@gmail.com>
* [3.13] gh-117657: Skip tests that use threads after fork (GH-122194) (#122198)Miss Islington (bot)2024-07-231-0/+3
| | | | | | | These tests fail when run under thread sanitizer due to the use of fork and threads. (cherry picked from commit 64e221d7ada8f6c20189035c7e81503f4c914f04) Co-authored-by: Sam Gross <colesbury@gmail.com>
* [3.13] gh-87744: fix waitpid race while calling send_signal in asyncio ↵Miss Islington (bot)2024-07-011-0/+15
| | | | | | | | | | | (GH-121126) (#121194) gh-87744: fix waitpid race while calling send_signal in asyncio (GH-121126) 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. (cherry picked from commit bd473aa598c5161521a7018896dc124728214a6c) Co-authored-by: Kumar Aditya <kumaraditya@python.org>
* [3.13] gh-121025: Improve partialmethod.__repr__ (GH-121033) (#121037)Miss Islington (bot)2024-06-261-1/+1
| | | | | | | | gh-121025: Improve partialmethod.__repr__ (GH-121033) It no longer contains redundant commas and spaces. (cherry picked from commit d2646e3f45e3e4e831ee2ae84d55b161a361d592) Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
* [3.13] gh-113892: Add a extra check to `ProactorEventLoop.sock_connect` to ↵Miss Islington (bot)2024-06-011-2/+7
| | | | | | | ensure that the given socket is in non-blocking mode (GH-119519) (#119912) (cherry picked from commit cf3bba3f0671d2c9fee099e3ab0f78b98b176131) Co-authored-by: Kirill Podoprigora <kirill.bast9@mail.ru>
* [3.13] gh-119121: Fix and test `async.staggered.staggered_race` (GH-119173) ↵Miss Islington (bot)2024-05-201-0/+97
| | | | | | | | (#119206) gh-119121: Fix and test `async.staggered.staggered_race` (GH-119173) (cherry picked from commit 16b46ebd2b0025aa461fdfc95fbf98a4f04b49e6) Co-authored-by: Nikita Sobolev <mail@sobolevn.me>
* [3.13] gh-119064: Use os_helper.FakePath instead of pathlib.Path in tests ↵Miss Islington (bot)2024-05-161-6/+5
| | | | | | | (GH-119065) (GH-119087) (cherry picked from commit 0152dc4ff5534fa2948b95262e70ff6b202b9b99) Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
* gh-117722: Fix Stream.readuntil with non-bytes buffer objects (#117723)Bruce Merry2024-04-111-7/+14
| | | | | | | | | | | | | 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-092-0/+90
| | | | | | | | | | 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-081-0/+46
|
* gh-96471: Add asyncio queue shutdown (#104228)Laurie O2024-04-061-0/+199
| | | Co-authored-by: Duprat <yduprat@gmail.com>
* gh-117459: Keep the traceback in _convert_future_exc (#117460)rsp4jack2024-04-041-0/+19
|
* gh-77714: Provide an async iterator version of as_completed (GH-22491)Justin Turner Arthur2024-04-011-63/+219
| | | | | | | | | * 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-271-0/+5
|
* gh-91227: Ignore ERROR_PORT_UNREACHABLE in proactor recvfrom() (#32011)Erik Soma2024-03-232-0/+155
|
* gh-116333: Relax error string text expectations in SSL-related tests (GH-116334)Will Childs-Klein2024-03-211-4/+8
| | | | | | | | | | | | | | | | | | | * 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-201-5/+45
| | | | early by asyncio (GH-116774)
* gh-113538: Add asycio.Server.{close,abort}_clients (redo) (#116784)Pierre Ossman (ThinLinc team)2024-03-181-8/+88
| | | | | | | 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-121-88/+8
| | | | | | | | | | (#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-111-8/+88
| | | | | | 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-111-1/+2
| | | | 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-061-16/+25
|
* gh-116112: Fix `ResourceWarning` in `test_asyncio.test_stream` (#116371)Nikita Sobolev2024-03-051-0/+1
| | | Co-authored-by: @CendioOssman
* chore: fix typos (#116345)cui fliter2024-03-051-2/+2
| | | Signed-off-by: cui fliter <imcusg@gmail.com>
* gh-71052: Add test exclusions to support running the test suite on Android ↵Malcolm Smith2024-02-291-2/+2
| | | | (#115918)
* gh-112997: Don't log arguments in asyncio unless debugging (#115667)Pierre Ossman (ThinLinc team)2024-02-281-3/+21
| | | | | | 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-281-0/+25
| | | | | | | | | | 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-191-0/+16
| | | | (#115622)
* gh-113812: Allow DatagramTransport.sendto to send empty data (#115199)Jamie Phan2024-02-172-9/+32
| | | | 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-054-2/+19
| | | | | | | | | | | | | (#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.