gh-128002: fix `asyncio.all_tasks` against concurrent deallocations of tasks by kumaraditya303 · Pull Request #128541 · python/cpython · GitHub

github.com

Tin mới

kumaraditya303:async-finalize

GitHub CopilotWrite better code with AI

GitHub Copilot appDirect agents from issue to merge

ActionsAutomate any workflow

CodespacesInstant dev environments

IssuesPlan and track work

Code ReviewManage code changes

Code QualityEnforce quality at merge

GitHub Advanced SecurityFind and fix vulnerabilities

Code securitySecure your code as you build

Secret protectionStop leaks before they start

View all use cases

Financial services

View all industries

Software Development

GitHub SponsorsFund open source developers

Copilot for BusinessEnterprise-grade AI features

Premium SupportEnterprise-grade 24/7 support

Pull requests 2.6k

Security and quality 0

Audit asyncio thread safety #128002

stop the world in all tasks

awaiting core review

awaiting core review

View reviewed changes

Learn more about hiding disruptive comments

The reason will be displayed to describe this comment to others. Learn more.

_PyWeakref_GET_REF

From looking at the crash backtrace, I think the important thing here would be to use _Py_TryIncref in all_tasks like we do in _PyWeakref_GET_REF. This will avoid incref'ing objects that have zero refcount (and are eithe

use _Py_TryIncref to protect against concurrent deallocations

test_asyncio.test_free_threading.TestCFreeThreading.test_all_tasks_race crashes intermittently in free-threaded builds #128656

View reviewed changes

topic-free-threading

topic-free-threading