Commit Graph

1080 Commits

Author SHA1 Message Date
John 8d6d7386a3
gh-133016: Fix a reference to removed `asyncio.futures.TimeoutError` (#133019)
Just use the builtin `TimeoutError`, and remove the import of `futures`.
2025-04-26 18:57:08 +00:00
Kumar Aditya 05d27a84f4
gh-130322: drop deprecation of `asyncio.set_event_loop` (#132349) 2025-04-12 12:03:52 +05:30
alexey semenyuk 27d1443897
Use `assert*` comparison methods in `test_timer_comparison` (#129513) 2025-03-28 14:25:13 +00:00
Thomas Grainger 71ce4acb25
gh-131645: fix ResourceWarnings in `test_asyncio.test_events` (#131646) 2025-03-24 12:38:33 +00:00
Kumar Aditya ab6333f7f5
gh-128002: fix tsan race in closing socket in `test_sslproto` (#131399) 2025-03-18 16:20:47 +05:30
Kumar Aditya b0a4f6599a
gh-128002: fix tsan race in closing socket in `test_ssl` (#131397) 2025-03-18 15:41:43 +05:30
Victor Stinner 73ab9e2ede
gh-131152: Remove unused imports from tests (#131153) 2025-03-13 10:55:23 +01:00
Kumar Aditya fcf756adef
fix various warnings in `test_asyncio.test_tasks` (#131109) 2025-03-11 19:51:53 +00:00
Victor Stinner 6c48ed7d62
gh-130736: Fix asyncio test_shutdown_default_executor_timeout() (#130800)
Replace time.sleep() with threading.Event.
2025-03-04 11:16:07 +00:00
Kumar Aditya d73d69e232
gh-129874: improve tests to use correct implementations in asyncio (#130516) 2025-02-24 21:33:52 +05:30
Kumar Aditya 2e3e65380b
improve `test_tasks` to use correct idiom for starting task in asyncio (#130257)
The test should use the correct idiom for starting the task, `loop._run_once` is private API which should not be used directly, instead use `asyncio.sleep(0)` for 1 event loop cycle.
2025-02-18 12:08:25 +00:00
AN Long 798f8d3ea9
Replace non-breaking spaces with normal spaces (#130116)
Using normal spaces in place of non-breaking spaces.
2025-02-16 09:33:14 +08:00
Kumar Aditya a545749b0e
gh-130145: fix `loop.run_forever` when loop is already running (#130146) 2025-02-15 15:01:53 +05:30
Kumar Aditya 94cd2e0dde
gh-129289: fix crash when task finalizer is not called in asyncio (#129840) 2025-02-10 17:03:59 +05:30
Kumar Aditya f7c7decc4c
gh-129874: improve test_events to use correct task implementation (#129891) 2025-02-09 18:36:16 +05:30
Kumar Aditya ce0cf7a73a
gh-129874: improve `test_tasks` in asyncio to use correct internal functions (#129890) 2025-02-09 13:02:11 +00:00
Kumar Aditya 09fe550ecc
gh-129874: improve asyncio tests to use correct internal functions (#129887) 2025-02-09 12:05:39 +00:00
Kumar Aditya 49bd47d5f1
improve `test_log_destroyed_pending_task` in asyncio (#129821) 2025-02-07 18:00:59 +00:00
Kumar Aditya f52a3a51eb
fix tests in `test_asyncio.test_tasks` to use correct `all_tasks` (#129815) 2025-02-07 21:46:26 +05:30
Kumar Aditya 0d68b14a0d
gh-128002: use per threads tasks linked list in asyncio (#128869)
Co-authored-by: Łukasz Langa <lukasz@langa.pl>
2025-02-06 19:51:07 +01:00
Vojtěch Boček 4e38eeafe2
gh-115514: Fix incomplete writes after close while using ssl in asyncio(#128037)
Co-authored-by: Kumar Aditya <kumaraditya@python.org>
2025-02-02 15:11:25 +00:00
Kumar Aditya e635bf2e49
gh-128002: fix `test_all_tasks_different_thread` in asyncio (#129267) 2025-01-24 23:10:24 +05:30
Kumar Aditya 8e0b36006c
gh-128002: use `_PyObject_SetMaybeWeakref` when creating tasks in asyncio (#128885) 2025-01-24 21:12:56 +05:30
Thomas Grainger ec91e1c276
gh-128479: fix asyncio staggered race leaking tasks, and logging unhandled exception.append exception (#128475)
Co-authored-by: Peter Bierma <zintensitydev@gmail.com>
2025-01-23 16:53:53 +01:00
Yury Selivanov 188598851d
GH-91048: Add utils for capturing async call stack for asyncio programs and enable profiling (#124640)
Signed-off-by: Pablo Galindo <pablogsal@gmail.com>
Co-authored-by: Pablo Galindo <pablogsal@gmail.com>
Co-authored-by: Kumar Aditya <kumaraditya@python.org>
Co-authored-by: Łukasz Langa <lukasz@langa.pl>
Co-authored-by: Savannah Ostrowski <savannahostrowski@gmail.com>
Co-authored-by: Jacob Coffee <jacob@z7x.org>
Co-authored-by: Irit Katriel <1055913+iritkatriel@users.noreply.github.com>
2025-01-22 17:25:29 +01:00
Łukasz Langa 2ed5ee9a50
gh-129158: Fix unwanted trailing whitespace in test_asyncio.test_subprocess (#129181) 2025-01-22 13:52:45 +00:00
Pablo Galindo Salgado a9f5edbf5f
gh-129158: Ensure we restore unix_events.can_use_pidfd after SubprocessThreadedWatcherTests finishes (#129160) 2025-01-22 12:25:42 +00:00
Thomas Grainger ed6934e71e
gh-128588: gh-128550: remove eager tasks optimization that missed and introduced incorrect cancellations (#129063)
Co-authored-by: Kumar Aditya <kumaraditya@python.org>
2025-01-20 17:13:01 +00:00
Thomas Grainger 38a9956876
gh-128308: pass `**kwargs` to asyncio task_factory (#128768)
Co-authored-by: Kumar Aditya <kumaraditya@python.org>
2025-01-20 22:23:55 +05:30
Serhiy Storchaka c6b570e5e3
gh-71339: Use new assertion methods in `test_asyncio` (#129051) 2025-01-20 17:02:39 +05:30
Kumar Aditya 3efe28a40b
gh-128002: add more thread safety tests for asyncio (#128480) 2025-01-13 15:36:55 +00:00
Thomas Grainger 61b9811ac6
gh-128552: fix refcycles in eager task creation (#128553) 2025-01-07 11:44:57 +00:00
Kumar Aditya 7e8c571604
gh-128340: add thread safe handle for `loop.call_soon_threadsafe` (#128369)
Adds `_ThreadSafeHandle` to be used for callbacks scheduled with `loop.call_soon_threadsafe`.
2025-01-06 18:05:11 +05:30
Kumar Aditya 513a4efa75
gh-128002: fix many thread safety issues in asyncio (#128147)
* 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
2025-01-04 14:18:22 +05:30
jb2170 830e10651b
gh-127529: Correct asyncio's `accept_connection` behaviour for handling `ConnectionAbortedError` (#127532)
Co-authored-by: Kumar Aditya <kumaraditya@python.org>
2025-01-03 10:32:36 +00:00
Kumar Aditya 9fce906825
gh-127949: deprecate `asyncio.set_event_loop` (#128218)
Deprecate `asyncio.set_event_loop` to be removed in Python 3.16.
2024-12-24 19:24:28 +05:30
Kumar Aditya a391d80f4b
gh-127949: deprecate asyncio policy classes (#128216) 2024-12-24 17:30:26 +05:30
Thomas Grainger b66a4ad9fc
gh-127949: fix resource warnings in `test_tasks.py` (#128172) 2024-12-22 18:16:02 +05:30
Kumar Aditya dbd08fb60d
gh-127949: deprecate `asyncio.get_event_loop_policy` (#128053)
This deprecates `asyncio.get_event_loop_policy` and will be removed in Python 3.16.
2024-12-18 18:04:20 +05:30
Kumar Aditya 5892853fb7
gh-127949: deprecate `asyncio.set_event_loop_policy` (#128024)
First step towards deprecating the asyncio policy system.
This deprecates `asyncio.set_event_loop_policy` and will be removed in Python 3.16.
2024-12-18 11:35:29 +05:30
J. Nick Koston e991ac8f20
gh-127655: Ensure `_SelectorSocketTransport.writelines` pauses the protocol 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>
2024-12-06 10:03:03 +05:30
Victor Stinner bfabf96b50
gh-127258: Fix asyncio test_staggered_race_with_eager_tasks() (#127358)
Replace the sleep(2) with a task which is blocked forever.
2024-11-29 11:39:54 +01:00
Kumar Aditya fe5a6ab7be
gh-126353: remove implicit creation of loop from `asyncio.get_event_loop` (#126354)
Remove implicit creation of loop from `asyncio.get_event_loop`. This is a step forward of deprecating the policy system of asyncio.
2024-11-04 14:21:20 +05:30
Nico-Posada d07dcce693
gh-126083: Fix a reference leak in `asyncio.Task` when reinitializing with new non-`None` context (#126103) 2024-10-31 10:47:57 +03:00
Bénédikt Tran ed5059eeb1
gh-125966: fix use-after-free on `fut->fut_callback0` due to an evil callback's `__eq__` in asyncio (#125967) 2024-10-27 22:40:10 +05:30
Bénédikt Tran f819d4301d
gh-125984: fix use-after-free on `fut->fut_{callback,context}0` due to an evil `loop.__getattribute__` (#126003) 2024-10-27 20:34:43 +05:30
Bénédikt Tran c5b99f5c2c
gh-125969: fix OOB in `future_schedule_callbacks` due to an evil `call_soon` (#125970)
Co-authored-by: Andrew Svetlov <andrew.svetlov@gmail.com>
2024-10-25 23:45:09 +05:30
Kumar Aditya cae853e3b4
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.
2024-10-25 18:19:30 +05:30
Javad Shafique 3f24bde0b6
gh-118950: Fix SSLProtocol.connection_lost not being called when OSError is thrown (#118960)
Co-authored-by: Kumar Aditya <kumaraditya@python.org>
2024-10-24 17:41:16 +00:00
Thomas Grainger 0b28ea4a35
gh-124958: Revert "gh-125472: Revert "gh-124958: fix asyncio.TaskGroup and _PyFuture refcycles ... (#125486)
* Revert "gh-125472: Revert "gh-124958: fix asyncio.TaskGroup and _PyFuture refcycles (#12… (#125476)"

This reverts commit e99650b80a.

* fix incompatability with gh-124392
2024-10-14 15:45:58 -07:00