Title: Audit asyncio thread safety · Issue #128002 · python/cpython · GitHub
Open Graph Title: Audit asyncio thread safety · Issue #128002 · python/cpython
X Title: Audit asyncio thread safety · Issue #128002 · python/cpython
Description: The following functions needs to be made thread safe and atomic for free-threading for both pure python and C implementation: asyncio._enter_task asyncio._leave_task asyncio._register_task asyncio._unregister_task asyncio._swap_current_t...
Open Graph Description: The following functions needs to be made thread safe and atomic for free-threading for both pure python and C implementation: asyncio._enter_task asyncio._leave_task asyncio._register_task asyncio....
X Description: The following functions needs to be made thread safe and atomic for free-threading for both pure python and C implementation: asyncio._enter_task asyncio._leave_task asyncio._register_task asyncio....
Opengraph URL: https://github.com/python/cpython/issues/128002
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Audit asyncio thread safety ","articleBody":"The following functions needs to be made thread safe and atomic for free-threading for both pure python and C implementation:\r\n\r\n- [x] `asyncio._enter_task`\r\n- [x] `asyncio._leave_task` \r\n- [x] `asyncio._register_task`\r\n- [x] `asyncio._unregister_task`\r\n- [x] `asyncio._swap_current_task` \r\n- [x] `asyncio.current_task` \r\n- [x] `asyncio.all_tasks` \r\n\r\nNote that some of these were made thread safe in C impl https://github.com/python/cpython/issues/120974\r\n\r\nThe following classes needs to be thread safe for free-threading in C implementation: \r\n- [x] `asyncio.Task`\r\n- [x] `asyncio.Future`\r\n\r\nBoth of these classes are documented to be not thread safe but currently calling methods on these classes from multiple threads can crash the interpreter. The pure python implementation cannot crash the interpreter when called from multiple threads so changes are only needed for C implementation. Before making these thread safe in C I would gather some numbers for how much a difference the C implementation makes in free-threading and if it isn't much we can just disable the C extension for free-threading. \r\n\r\ncc @colesbury \r\n\r\n\n\n\u003c!-- gh-linked-prs --\u003e\n### Linked PRs\n* gh-128147\n* gh-128256\n* gh-128480\n* gh-128541\n* gh-128869\n* gh-128885\n* gh-129267\n* gh-129942\n* gh-129943\n* gh-129995\n* gh-130518\n* gh-131106\n* gh-131397\n* gh-131399\n* gh-131797\n* gh-134362\n* gh-134324\n\u003c!-- /gh-linked-prs --\u003e\n","author":{"url":"https://github.com/kumaraditya303","@type":"Person","name":"kumaraditya303"},"datePublished":"2024-12-16T18:29:13.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":12},"url":"https://github.com/128002/cpython/issues/128002"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:d0cabbb9-c70f-9299-fe0f-b8e8ec12cebf |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | AC6E:9D4F4:F9CF0B:1577B89:6969F2DD |
| html-safe-nonce | efed4f650405bbd0354114c23d0181928f4a7e32f6204644987064435baa65fb |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJBQzZFOjlENEY0OkY5Q0YwQjoxNTc3Qjg5OjY5NjlGMkREIiwidmlzaXRvcl9pZCI6IjQyNTcyNDIxMzg5OTE1MjI1MjUiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | e95d2f07808c62499101ac541780ef6af1958fd36423e4006eac8f21677d2706 |
| hovercard-subject-tag | issue:2743096414 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/python/cpython/128002/issue_layout |
| twitter:image | https://opengraph.githubassets.com/d8721c075d83d01a46fc68ff2d64b461893218ca478e6473259834df217dc3cd/python/cpython/issues/128002 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/d8721c075d83d01a46fc68ff2d64b461893218ca478e6473259834df217dc3cd/python/cpython/issues/128002 |
| og:image:alt | The following functions needs to be made thread safe and atomic for free-threading for both pure python and C implementation: asyncio._enter_task asyncio._leave_task asyncio._register_task asyncio.... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | kumaraditya303 |
| hostname | github.com |
| expected-hostname | github.com |
| None | 7b32f1c7c4549428ee399213e8345494fc55b5637195d3fc5f493657579235e8 |
| turbo-cache-control | no-preview |
| go-import | github.com/python/cpython git https://github.com/python/cpython.git |
| octolytics-dimension-user_id | 1525981 |
| octolytics-dimension-user_login | python |
| octolytics-dimension-repository_id | 81598961 |
| octolytics-dimension-repository_nwo | python/cpython |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 81598961 |
| octolytics-dimension-repository_network_root_nwo | python/cpython |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | bdde15ad1b403e23b08bbd89b53fbe6bdf688cad |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width