You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
HandleTable mutated without the GIL via _pm_release (suspected race) #117
Found while investigating #98 (by reading, not observed): UpcallTrampoline.releaseObject, reached through ctypes _pm_release (which releases the GIL around the foreign call), mutates HandleTable without the GIL, while AsyncUpcall.kt states every HandleTable mutation happens under the GIL. Under free-threaded or concurrent use this can corrupt the table.
Completion: either prove the call holds a lock that makes it safe (and document it), or take the GIL / the table's own lock on that path; a concurrency stress test (many threads releasing and registering handles) passes under -PpythonFreeThreaded=true and default.
Activity
Merge pull request #302 from thisisthepy/feat/pmp-handle-lock
b-re-w commentedon Oct 25, 2026
Landed in develop via #302. Cause confirmed: ctypes CFUNCTYPE drops the GIL around _pm_release/_pm_resolve. HandleTable now owns a PlatformMutex.