Skip to content

Commit cbc7d46

Browse files
committed
Address feedback
1 parent a11038f commit cbc7d46

File tree

1 file changed

+4
-9
lines changed

1 file changed

+4
-9
lines changed

Doc/library/threadsafety.rst

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -300,13 +300,8 @@ and will not corrupt the set:
300300
These operations also compare elements, so the same :meth:`~object.__eq__`
301301
considerations as above apply.
302302

303-
The following operations return new objects and hold the per-object lock
304-
for the duration:
305-
306-
.. code-block::
307-
:class: good
308-
309-
s.copy() # returns a shallow copy
303+
The :meth:`~set.copy` method returns a new object and holds the per-object lock
304+
for the duration so that it is always atomic.
310305

311306
The :meth:`~set.clear` method holds the lock for its duration. Other
312307
threads cannot observe elements being removed.
@@ -341,8 +336,8 @@ The update variants of the above methods also have some differences between
341336
them:
342337

343338
* :meth:`set.difference_update` and :meth:`set.intersection_update` try
344-
to lock all objects.
345-
* :meth:`set.symmetric_difference_update` only lock the argument if it is
339+
to lock all objects one-by-one.
340+
* :meth:`set.symmetric_difference_update` only locks the arguments if it is
346341
of type :class:`set`, :class:`frozenset`, or :class:`dict`.
347342

348343
The following methods always try to lock both objects:

0 commit comments

Comments
 (0)