Closed
Description
Feature or enhancement
The collections.deque
object has mutable internal state that would not be thread-safe without the GIL. We should use the critical section API to make it thread-safe. I think it might be cleanest to first convert most of the deque implementation to Argument Clinic and use the @critical_section
directive rather than writing the critical sections manually.
Mostly for my own reference, here is the implementation from nogil-3.12
: colesbury/nogil-3.12@f1e4742eaa. That implementation did not use the critical section API, which made it more complicated.
Depends on: #111903