@@ -236,11 +236,6 @@ static int dictresize(PyDictObject *mp, uint8_t log_newsize, int unicode);
236236
237237static PyObject * dict_iter (PyDictObject * dict );
238238
239- /*Global counter used to set ma_version_tag field of dictionary.
240- * It is incremented each time that a dictionary is created and each
241- * time that a dictionary is modified. */
242- uint64_t _pydict_global_version = 0 ;
243-
244239#include "clinic/dictobject.c.h"
245240
246241
@@ -5681,7 +5676,7 @@ validate_watcher_id(PyInterpreterState *interp, int watcher_id)
56815676 PyErr_Format (PyExc_ValueError , "Invalid dict watcher ID %d" , watcher_id );
56825677 return -1 ;
56835678 }
5684- if (!interp -> dict_watchers [watcher_id ]) {
5679+ if (!interp -> dict_state . watchers [watcher_id ]) {
56855680 PyErr_Format (PyExc_ValueError , "No dict watcher set for ID %d" , watcher_id );
56865681 return -1 ;
56875682 }
@@ -5724,8 +5719,8 @@ PyDict_AddWatcher(PyDict_WatchCallback callback)
57245719 PyInterpreterState * interp = _PyInterpreterState_GET ();
57255720
57265721 for (int i = 0 ; i < DICT_MAX_WATCHERS ; i ++ ) {
5727- if (!interp -> dict_watchers [i ]) {
5728- interp -> dict_watchers [i ] = callback ;
5722+ if (!interp -> dict_state . watchers [i ]) {
5723+ interp -> dict_state . watchers [i ] = callback ;
57295724 return i ;
57305725 }
57315726 }
@@ -5741,7 +5736,7 @@ PyDict_ClearWatcher(int watcher_id)
57415736 if (validate_watcher_id (interp , watcher_id )) {
57425737 return -1 ;
57435738 }
5744- interp -> dict_watchers [watcher_id ] = NULL ;
5739+ interp -> dict_state . watchers [watcher_id ] = NULL ;
57455740 return 0 ;
57465741}
57475742
@@ -5755,7 +5750,7 @@ _PyDict_SendEvent(int watcher_bits,
57555750 PyInterpreterState * interp = _PyInterpreterState_GET ();
57565751 for (int i = 0 ; i < DICT_MAX_WATCHERS ; i ++ ) {
57575752 if (watcher_bits & 1 ) {
5758- PyDict_WatchCallback cb = interp -> dict_watchers [i ];
5753+ PyDict_WatchCallback cb = interp -> dict_state . watchers [i ];
57595754 if (cb && (cb (event , (PyObject * )mp , key , value ) < 0 )) {
57605755 // some dict modification paths (e.g. PyDict_Clear) can't raise, so we
57615756 // can't propagate exceptions from dict watchers.
0 commit comments