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
Kirill Podoprigora
e99650b80a
gh-125472: Revert "gh-124958: fix asyncio.TaskGroup and _PyFuture refcycles (#12… ( #125476 )
...
Revert "gh-124958: fix asyncio.TaskGroup and _PyFuture refcycles (#124959 )"
This reverts commit d5dbbf4372
.
2024-10-14 17:59:13 +00:00
Thomas Grainger
d5dbbf4372
gh-124958: fix asyncio.TaskGroup and _PyFuture refcycles ( #124959 )
2024-10-14 08:19:56 -07:00
Thomas Grainger
979c0df7c0
gh-124309: fix staggered race on eager tasks ( #124847 )
...
This patch is entirely by Thomas and Peter
Co-authored-by: Thomas Grainger <tagrain@gmail.com>
Co-authored-by: Peter Bierma <zintensitydev@gmail.com>
2024-10-11 16:31:06 -07:00
Mark Shannon
da071fa3e8
GH-119866: Spill the stack around escaping calls. (GH-124392)
...
* 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.
2024-10-07 14:56:39 +01:00
Thomas Grainger
c066bf5535
gh-124858: fix happy eyeballs refcyles ( #124859 )
2024-10-02 16:32:31 -07:00
Peter Bierma
133e929a79
gh-124309: Revert eager task factory fix to prevent breaking downstream ( #124810 )
...
* Revert "GH-124639: add back loop param to staggered_race (#124700 )"
This reverts commit e0a41a5dd1
.
* Revert "gh-124309: Modernize the `staggered_race` implementation to support eager task factories (#124390 )"
This reverts commit de929f353c
.
2024-09-30 18:37:27 -07:00
Kumar Aditya
e0a41a5dd1
GH-124639: add back loop param to staggered_race ( #124700 )
2024-09-29 08:42:46 +05:30
Ron Frederick
1229cb8c14
gh-120284: Enhance asyncio.run
to accept awaitable objects ( #120566 )
...
Co-authored-by: Kumar Aditya <kumaraditya@python.org>
2024-09-26 11:45:08 +05:30
Peter Bierma
de929f353c
gh-124309: Modernize the staggered_race
implementation to support eager 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>
2024-09-26 05:11:17 +00:00
Alexander Kanavin
1ff1b899ce
gh-119400: make_ssl_certs: update reference test data automatically, pass 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>
2024-09-25 21:23:47 +00:00
Loïc Estève
eadb9660ed
gh-122957: Fix test flakiness in asyncio test in free-thread build ( #124039 )
2024-09-13 11:13:30 -07:00
Petr Viktorin
b379f1b26c
gh-122136: test_asyncio: Don't fail if the kernel buffers more data than advertised (GH-123423)
2024-08-28 22:36:42 +02:00
Wulian
94036e43a8
Fix typos in comments ( #123201 )
2024-08-21 12:49:23 +00:00
Xie Yanbo
253c6a0b2f
Fix typos in comments and test code ( #122846 )
2024-08-11 21:16:41 -07:00
Wulian
bc9d92c679
gh-122858: Deprecate asyncio.iscoroutinefunction
( #122875 )
...
Deprecate `asyncio.iscoroutinefunction` in favor of `inspect.iscoroutinefunction`.
Co-authored-by: Kumar Aditya <kumaraditya@python.org>
2024-08-11 16:35:51 +00:00
Peter Bierma
c08696286f
gh-122332: Fix missing NULL
check in asyncio.Task.get_coro
( #122338 )
2024-07-27 11:57:48 +05:30
Sam Gross
2f74b709b6
gh-122187: Avoid TSan reported race in run_udp_echo_server
( #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.
2024-07-25 13:46:53 +05:30
Sam Gross
64e221d7ad
gh-117657: Skip tests that use threads after fork ( #122194 )
...
These tests fail when run under thread sanitizer due to the use of fork
and threads.
2024-07-23 16:30:49 -04:00
Kumar Aditya
bd473aa598
gh-87744: fix waitpid race while calling send_signal in asyncio ( #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.
2024-07-01 10:17:36 +05:30
Bénédikt Tran
d2646e3f45
gh-121025: Improve partialmethod.__repr__ (GH-121033)
...
It no longer contains redundant commas and spaces.
2024-06-26 12:08:27 +03:00
Kumar Aditya
9d2e1ea386
GH-120804: Remove PidfdChildWatcher
, ThreadedChildWatcher
and AbstractChildWatcher
from asyncio APIs ( #120893 )
2024-06-23 18:38:50 +05:30