Ben <benjsim...@gmail.com> added the comment:

I can reproduce on 3.9.6

A little digging and it seems asyncio imports Task from _asyncio
and _asyncio's implementation (in asynciomodule.c) of Task has an __init__ 
which adds the task to the `all_tasks` weakref.WeakSet
which appears to be implemented in Python (in Lib/_weakrefset.py)

weakref.WeakSet is not thread-safe,  which means concurrent create_task's in 
different threads (even on separate event loops) is not safe.

----------
nosy: +bjs

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue44962>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to