Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

gh-112050: Make collections.deque thread-safe in free-threaded builds #113830

Merged
merged 58 commits into from
Feb 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
58 commits
Select commit Hold shift + click to select a range
de90440
Convert most collections.deque method use clinic
mpage Dec 22, 2023
010d12c
Make deque.pop thread-safe
mpage Dec 22, 2023
32452db
Make deque.popleft thread-safe
mpage Dec 22, 2023
a73aa10
Make deque.append thread-safe
mpage Dec 22, 2023
759d149
Make deque.appendleft thread-safe
mpage Dec 22, 2023
c0b14ea
Make deque.count thread-safe
mpage Jan 5, 2024
72bee62
Make deque.index thread-safe
mpage Jan 5, 2024
2fd397a
Make deque.insert thread-safe
mpage Jan 5, 2024
dbe49a0
Make deque.remove thread-safe
mpage Jan 5, 2024
5af87e4
Make deque.rotate thread-safe
mpage Jan 5, 2024
6fcd551
Make deque.reverse thread-safe
mpage Jan 5, 2024
70f07a7
Make deque.contains thread-safe
mpage Jan 5, 2024
16bbe58
Make deque indexing thread-safe
mpage Jan 5, 2024
cbd01c7
Make deque item assignment thread-safe
mpage Jan 5, 2024
92782b1
Make deque.extend thread-safe
mpage Jan 5, 2024
112b6c9
Make deque.extendleft thread-safe
mpage Jan 5, 2024
a4201f1
Add note about why inplace concat doesn't need a critical section
mpage Jan 5, 2024
1e7d0b8
Make deque.clear thread-safe
mpage Jan 5, 2024
54975b9
Make deque's inplace repeat thread-safe
mpage Jan 6, 2024
1deb61c
Make deque.copy thread-safe
mpage Jan 6, 2024
6b1cb43
Make deque.repeat thread-safe
mpage Jan 6, 2024
1957c92
Make deque concat thread-safe
mpage Jan 6, 2024
6141ce5
Make deque.__reduce__ thread-safe
mpage Jan 6, 2024
182a034
Make deque.len thread-safe
mpage Jan 6, 2024
c8fdcec
Make deque.__init__ thread-safe
mpage Jan 6, 2024
125d253
Make deque.__sizeof__ thread-safe
mpage Jan 6, 2024
7cea52d
Remove critical section around deque's tp_clear
mpage Jan 6, 2024
f0f86d2
Make dequeiter ctor thread-safe
mpage Jan 6, 2024
02efe9b
Make dequeiter_next thread-safe
mpage Jan 6, 2024
99ffbba
Make dequiter_len thread-safe
mpage Jan 6, 2024
edb6ffa
Make dequeiter_reduce thread-safe
mpage Jan 6, 2024
0beaf72
Fix usage of critical section
mpage Jan 6, 2024
d972957
Make dequereviter_next thread-safe
mpage Jan 6, 2024
ac2ee0e
Detail why we don't need to lock in new
mpage Jan 8, 2024
ce68613
Formatting fixes for PEP-007
mpage Jan 8, 2024
195949e
Merge remote-tracking branch 'upstream/main' into deque-clinic
mpage Jan 8, 2024
17d19da
📜🤖 Added by blurb_it.
blurb-it[bot] Jan 8, 2024
db02d54
Fix formatting of NEWS entry
mpage Jan 8, 2024
03c4cd9
Merge branch 'main' into ft-thread-safe-deque
mpage Jan 29, 2024
6e68cad
Use `_lock_held` suffix for functions that require the per-object lock
mpage Jan 30, 2024
72ea9eb
Shorten NEWS entry
mpage Jan 30, 2024
9f80af8
Revert changes to append helpers to minimize churn
mpage Jan 30, 2024
fc91a83
Use recursive impl for extendleft and extend
mpage Jan 30, 2024
7d65ac5
Fix critical section
mpage Jan 30, 2024
8072617
Revert NEEDS_TRIM refactor
mpage Jan 30, 2024
672184d
Don't need to protect type accesses w/ CS
mpage Jan 30, 2024
4461a00
Remove defensive initializations
mpage Jan 30, 2024
b6741e3
Relax critsecs accesses that are immutable post construction
mpage Jan 30, 2024
0519f72
Fix critsec for dequeiter_reduce
mpage Jan 30, 2024
339dcd9
Revert style changes
mpage Feb 1, 2024
7dfb55f
Merge branch 'main' into ft-thread-safe-deque
erlend-aasland Feb 1, 2024
fdadbf9
Update Misc/NEWS.d/next/Core and Builtins/2024-01-08-21-57-41.gh-issu…
erlend-aasland Feb 1, 2024
3c10498
Merge branch 'main' into ft-thread-safe-deque
mpage Feb 5, 2024
1d00d9f
Merge branch 'main' into ft-thread-safe-deque
mpage Feb 14, 2024
b166202
Merge branch 'main' into ft-thread-safe-deque
mpage Feb 14, 2024
6e64ef4
Use free-threaded atomic wrapper for loading deque_iter len
mpage Feb 14, 2024
6ffad44
Merge remote-tracking branch 'origin/ft-thread-safe-deque' into ft-th…
mpage Feb 14, 2024
fa7e8a8
Use free-threaded atomic wrapper in deque_len, too
mpage Feb 14, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions Include/internal/pycore_pyatomic_ft_wrappers.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,13 @@ extern "C" {
#endif

#ifdef Py_GIL_DISABLED
#define FT_ATOMIC_LOAD_SSIZE(value) _Py_atomic_load_ssize(&value)
#define FT_ATOMIC_LOAD_SSIZE_RELAXED(value) \
_Py_atomic_load_ssize_relaxed(&value)
#define FT_ATOMIC_STORE_SSIZE_RELAXED(value, new_value) \
_Py_atomic_store_ssize_relaxed(&value, new_value)
#else
#define FT_ATOMIC_LOAD_SSIZE(value) value
#define FT_ATOMIC_LOAD_SSIZE_RELAXED(value) value
#define FT_ATOMIC_STORE_SSIZE_RELAXED(value, new_value) value = new_value
#endif
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Make methods on :class:`collections.deque` thread-safe when the GIL is disabled.
Loading
Loading