Repository navigation
Permalink
Choose a base ref
{{ refName }}
default
Choose a head ref
{{ refName }}
default
Checking mergeability…
Don’t worry, you can still create the pull request.
Comparing changes
Choose two branches to see what’s changed or to start a new pull request.
If you need to, you can also or
learn more about diff comparisons.
Open a pull request
Create a new pull request by comparing changes across two branches. If you need to, you can also .
Learn more about diff comparisons here.
base repository: python/cpython
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: main
Could not load branches
Nothing to show
Loading
Could not load tags
Nothing to show
{{ refName }}
default
Loading
...
head repository: jblespiau/cpython
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: fix-asyncio-task-unregister-race
Could not load branches
Nothing to show
Loading
Could not load tags
Nothing to show
{{ refName }}
default
Loading
- 13 commits
- 3 files changed
- 4 contributors
Commits on Oct 15, 2026
-
gh-159449: Fix a free-threaded asyncio race that corrupts the task lists
When a thread exits with pending asyncio Tasks, PyThreadState_Clear() moves them onto the shared interp->asyncio_tasks_head list, but each Task still records the _Py_ThreadId() of the thread that created it. unregister_task() skips the stop-the-world pause whenever that id matches the current thread. That also happens for a later thread that reuses the exited thread's pthread_t, and for destructors that run later in PyThreadState_Clear(). The resulting unlocked llist_remove() calls on the shared list race with each other and can leave an already-removed node (next == NULL) linked into it. asyncio.all_tasks(), which asyncio.run() calls on shutdown, then crashes with SIGSEGV in _asyncio_all_tasks(). Record the unique id (PyThreadState.id) of the creating thread state instead, and only take the lock-free path while that thread state is not being cleared. Also drop the assertion in add_tasks_llist() that every linked Task is pending. A Task's state is set before unregister_task() unlinks it, and that removal can be waiting for the stop-the-world pause during which the list is walked. add_one_task() already filters out Tasks that are done.
Configuration menu - View commit details
-
Copy full SHA for 8e75acc - Browse repository at this point
Copy the full SHA 8e75accView commit details -
Configuration menu - View commit details
-
Copy full SHA for e60bb19 - Browse repository at this point
Copy the full SHA e60bb19View commit details -
Configuration menu - View commit details
-
Copy full SHA for acea81d - Browse repository at this point
Copy the full SHA acea81dView commit details -
Configuration menu - View commit details
-
Copy full SHA for e79f79e - Browse repository at this point
Copy the full SHA e79f79eView commit details
Commits on Nov 2, 2026
-
Configuration menu - View commit details
-
Copy full SHA for 78ffcac - Browse repository at this point
Copy the full SHA 78ffcacView commit details -
Configuration menu - View commit details
-
Copy full SHA for 58c83fc - Browse repository at this point
Copy the full SHA 58c83fcView commit details -
Merge branch 'main' of https://github.com/python/cpython into fix-asy…
…ncio-task-unregister-race
Configuration menu - View commit details
-
Copy full SHA for 3f23308 - Browse repository at this point
Copy the full SHA 3f23308View commit details -
Configuration menu - View commit details
-
Copy full SHA for 0def8d4 - Browse repository at this point
Copy the full SHA 0def8d4View commit details -
Configuration menu - View commit details
-
Copy full SHA for 5a64c43 - Browse repository at this point
Copy the full SHA 5a64c43View commit details
Commits on Nov 5, 2026
-
Configuration menu - View commit details
-
Copy full SHA for 12ea214 - Browse repository at this point
Copy the full SHA 12ea214View commit details -
Configuration menu - View commit details
-
Copy full SHA for ab6f461 - Browse repository at this point
Copy the full SHA ab6f461View commit details -
Configuration menu - View commit details
-
Copy full SHA for d472986 - Browse repository at this point
Copy the full SHA d472986View commit details -
Configuration menu - View commit details
-
Copy full SHA for d8ed8d2 - Browse repository at this point
Copy the full SHA d8ed8d2View commit details
Loading
This comparison is taking too long to generate.
Unfortunately it looks like we can’t render this comparison for you right now. It might be too big, or there might be something weird with your repository.
You can try running this command locally to see the comparison on your machine:
git diff main...fix-asyncio-task-unregister-race