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
list(set) should be atomic in the free-threaded build #116621
if (child_popen:=p._popen) andchild_popen.poll() isnotNone:
_children.discard(p)
This is a fairly common pattern currently, but in the free-threaded build, this may lead to RuntimeError: Set changed size during iteration. We should make it so that list(set) locks the set to avoid the error and so that the list contains a consistent copy of the set.
For additional context, see the following code from the nogil-3.12 fork:
There are a few other cases in nogil-3.12 that we probably want to handle atomically as well, because I think we use the same pattern where the calling code assumes list(some_type) is atomic for certain built-in types:
Activity
colesbury commentedon Mar 11, 2024
This is also important for
test_multiprocessing_pool_circular_importintest_importlib.colesbury commentedon Mar 11, 2024
There are a few other cases in nogil-3.12 that we probably want to handle atomically as well, because I think we use the same pattern where the calling code assumes
list(some_type)is atomic for certain built-in types:pythongh-116621: Set manual critical section for list.extend
Merge branch 'pythongh-116621' into nogil-integration
gh-116621: Set manual critical section for list.extend (gh-116657)
pythongh-116621: Specialize list.extend for dict keys/values
gh-116621: Specialize list.extend for dict keys/values (gh-116816)
pythongh-116621: Specialize list.extend for dict items
gh-116621: Specialize list.extend for dict items (gh-116888)
pythongh-116621: Set manual critical section for list.extend (pythong…
pythongh-116621: Specialize list.extend for dict keys/values (pythong…
pythongh-116621: Specialize list.extend for dict items (pythongh-116888)
pythongh-116621: Set manual critical section for list.extend (pythong…
pythongh-116621: Specialize list.extend for dict keys/values (pythong…
pythongh-116621: Specialize list.extend for dict items (pythongh-116888)
pythongh-116621: Set manual critical section for list.extend (pythong…
pythongh-116621: Specialize list.extend for dict keys/values (pythong…
pythongh-116621: Specialize list.extend for dict items (pythongh-116888)