Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit dc978f6

Browse filesBrowse files
authored
gh-112050: Make collections.deque thread-safe in free-threaded builds (#113830)
Use critical sections to make deque methods that operate on mutable state thread-safe when the GIL is disabled. This is mostly accomplished by using the @critical_section Argument Clinic directive, though there are a few places where this was not possible and critical sections had to be manually acquired/released.
1 parent 4742047 commit dc978f6
Copy full SHA for dc978f6

File tree

Expand file treeCollapse file tree

4 files changed

+338
-61
lines changed
Filter options
Expand file treeCollapse file tree

4 files changed

+338
-61
lines changed

‎Include/internal/pycore_pyatomic_ft_wrappers.h

Copy file name to clipboardExpand all lines: Include/internal/pycore_pyatomic_ft_wrappers.h
+2Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,13 @@ extern "C" {
2020
#endif
2121

2222
#ifdef Py_GIL_DISABLED
23+
#define FT_ATOMIC_LOAD_SSIZE(value) _Py_atomic_load_ssize(&value)
2324
#define FT_ATOMIC_LOAD_SSIZE_RELAXED(value) \
2425
_Py_atomic_load_ssize_relaxed(&value)
2526
#define FT_ATOMIC_STORE_SSIZE_RELAXED(value, new_value) \
2627
_Py_atomic_store_ssize_relaxed(&value, new_value)
2728
#else
29+
#define FT_ATOMIC_LOAD_SSIZE(value) value
2830
#define FT_ATOMIC_LOAD_SSIZE_RELAXED(value) value
2931
#define FT_ATOMIC_STORE_SSIZE_RELAXED(value, new_value) value = new_value
3032
#endif
+1Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Make methods on :class:`collections.deque` thread-safe when the GIL is disabled.

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.