Skip to content

Commit 4b96d6c

Browse files
add thread safety annotations for bytearray
1 parent 0c7a75a commit 4b96d6c

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

Doc/data/threadsafety.dat

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,3 +73,21 @@ PyList_Sort:shared:
7373
# Extend - lock target list; also lock source when it is a
7474
# list, set, or dict
7575
PyList_Extend:shared:
76+
77+
78+
# Creation from object - may call arbitrary code
79+
PyByteArray_FromObject:shared:
80+
81+
# Creation - pure allocation, no shared state
82+
PyByteArray_FromStringAndSize:atomic:
83+
84+
# Concatenation - uses buffer protocol; safe as long as buffer is not mutated by another thread during the operation
85+
PyByteArray_Concat:shared:
86+
87+
# Size - uses atomic load on free-threaded builds
88+
PyByteArray_Size:atomic:
89+
PyByteArray_GET_SIZE:atomic:
90+
91+
# Raw data - no locking; mutating it is unsafe if the bytearray object is shared between threads
92+
PyByteArray_AsString:compatible:
93+
PyByteArray_AS_STRING:compatible:

0 commit comments

Comments
 (0)