@@ -246,24 +246,41 @@ Dictionary Objects
246246 of error (e.g. no more watcher IDs available), return ``-1`` and set an
247247 exception.
248248
249+ .. versionadded:: 3.12
250+
249251.. c:function:: int PyDict_ClearWatcher(int watcher_id)
250252
251253 Clear watcher identified by *watcher_id* previously returned from
252254 :c:func:`PyDict_AddWatcher`. Return ``0`` on success, ``-1`` on error (e.g.
253255 if the given *watcher_id * was never registered.)
254256
257+ .. versionadded:: 3.12
258+
255259.. c:function:: int PyDict_Watch(int watcher_id, PyObject *dict)
256260
257261 Mark dictionary *dict * as watched. The callback granted *watcher_id * by
258262 :c:func: `PyDict_AddWatcher ` will be called when *dict * is modified or
259- deallocated.
263+ deallocated. Return ``0 `` on success or ``-1 `` on error.
264+
265+ .. versionadded :: 3.12
266+
267+ .. c :function :: int PyDict_Unwatch (int watcher_id, PyObject *dict)
268+
269+ Mark dictionary *dict * as no longer watched. The callback granted
270+ *watcher_id * by :c:func: `PyDict_AddWatcher ` will no longer be called when
271+ *dict * is modified or deallocated. The dict must previously have been
272+ watched by this watcher. Return ``0 `` on success or ``-1 `` on error.
273+
274+ .. versionadded :: 3.12
260275
261276.. c :type :: PyDict_WatchEvent
262277
263278 Enumeration of possible dictionary watcher events: ``PyDict_EVENT_ADDED ``,
264279 ``PyDict_EVENT_MODIFIED ``, ``PyDict_EVENT_DELETED ``, ``PyDict_EVENT_CLONED ``,
265280 ``PyDict_EVENT_CLEARED ``, or ``PyDict_EVENT_DEALLOCATED ``.
266281
282+ .. versionadded :: 3.12
283+
267284.. c :type :: int (*PyDict_WatchCallback)(PyDict_WatchEvent event, PyObject *dict, PyObject *key, PyObject *new_value)
268285
269286 Type of a dict watcher callback function.
@@ -289,3 +306,5 @@ Dictionary Objects
289306 If the callback returns with an exception set, it must return ``-1 ``; this
290307 exception will be printed as an unraisable exception using
291308 :c:func: `PyErr_WriteUnraisable `. Otherwise it should return ``0 ``.
309+
310+ .. versionadded :: 3.12
0 commit comments