From 85bf7c3794cf268f1a016420fbe36f85374151f6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?B=C3=A9n=C3=A9dikt=20Tran?= <10796600+picnixz@users.noreply.github.com> Date: Mon, 2 Dec 2024 13:52:53 +0100 Subject: [PATCH] Indicate that `Shelve.sync()` is not thread-safe. --- Doc/library/shelve.rst | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/Doc/library/shelve.rst b/Doc/library/shelve.rst index 6e74a59b82b8ec..f6c346f8e031ff 100644 --- a/Doc/library/shelve.rst +++ b/Doc/library/shelve.rst @@ -78,6 +78,13 @@ Two additional methods are supported: dictionary on disk, if feasible. This is called automatically when the shelf is closed with :meth:`close`. + .. warning:: + + During the call to :meth:`!sync`, the *writeback* attribute is set to + :const:`False` and other threads will stop updating the cache. As such, + this method is **not** thread-safe. + + .. method:: Shelf.close() Synchronize and close the persistent *dict* object. Operations on a closed