This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author asvetlov
Recipients Nick Davies, asvetlov, lukasz.langa, miss-islington, sdunster, thatch, yselivanov
Date 2019-06-12.17:26:52
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1560360412.57.0.19277940869.issue36607@roundup.psfhosted.org>
In-reply-to
Content
Lukasz, please don't rush.
Applied PR makes asyncio more stable, not worse.

I see the only way to make it perfect: get rid of weak refs entirely.
Otherwise there is always a chance to catch GC run and set element deletion on iteration over the set. Sorry, that's how weakrefs work.

There is such possibility: call asyncio._unregister_task() explicitly when the task is done (finished with success or failure or cancelled).
By this, we can replace weakset with a regular set.

The only requirement is that task should call this _unregister_task() method.
No public API change is needed.

At the time of work on 3.7, Yuri and I considered this implementation but rejected it because there was a (very low) chance that somebody may implement own task, register custom task factory and don't call _unregister_task().

I never see a code that implements asyncio task from scratch, people always reuse existing asyncio.Task.

So, maybe the idea is not such bad. It can be implemented easily. I'm volunteered to make a PR with the proposal demonstration in a day or two, depending on my free time.
History
Date User Action Args
2019-06-12 17:26:52asvetlovsetrecipients: + asvetlov, thatch, lukasz.langa, yselivanov, miss-islington, sdunster, Nick Davies
2019-06-12 17:26:52asvetlovsetmessageid: <1560360412.57.0.19277940869.issue36607@roundup.psfhosted.org>
2019-06-12 17:26:52asvetlovlinkissue36607 messages
2019-06-12 17:26:52asvetlovcreate