@@ -230,31 +230,6 @@ static inline PyDictUnicodeEntry* DK_UNICODE_ENTRIES(PyDictKeysObject *dk) {
230230#define DICT_WATCHER_MASK ((1 << DICT_MAX_WATCHERS) - 1)
231231#define DICT_WATCHER_AND_MODIFICATION_MASK ((1 << (DICT_MAX_WATCHERS + DICT_WATCHED_MUTATION_BITS)) - 1)
232232
233- #ifdef Py_GIL_DISABLED
234-
235- #define THREAD_LOCAL_DICT_VERSION_COUNT 256
236- #define THREAD_LOCAL_DICT_VERSION_BATCH THREAD_LOCAL_DICT_VERSION_COUNT * DICT_VERSION_INCREMENT
237-
238- static inline uint64_t
239- dict_next_version (PyInterpreterState * interp )
240- {
241- PyThreadState * tstate = PyThreadState_GET ();
242- uint64_t cur_progress = (tstate -> dict_global_version &
243- (THREAD_LOCAL_DICT_VERSION_BATCH - 1 ));
244- if (cur_progress == 0 ) {
245- uint64_t next = _Py_atomic_add_uint64 (& interp -> dict_state .global_version ,
246- THREAD_LOCAL_DICT_VERSION_BATCH );
247- tstate -> dict_global_version = next ;
248- }
249- return tstate -> dict_global_version += DICT_VERSION_INCREMENT ;
250- }
251-
252- #define DICT_NEXT_VERSION (INTERP ) dict_next_version(INTERP)
253-
254- #else
255- #define DICT_NEXT_VERSION (INTERP ) \
256- ((INTERP)->dict_state.global_version += DICT_VERSION_INCREMENT)
257- #endif
258233
259234PyAPI_FUNC (void )
260235_PyDict_SendEvent (int watcher_bits ,
@@ -263,20 +238,19 @@ _PyDict_SendEvent(int watcher_bits,
263238 PyObject * key ,
264239 PyObject * value );
265240
266- static inline uint64_t
241+ static inline void
267242_PyDict_NotifyEvent (PyInterpreterState * interp ,
268243 PyDict_WatchEvent event ,
269244 PyDictObject * mp ,
270245 PyObject * key ,
271246 PyObject * value )
272247{
273248 assert (Py_REFCNT ((PyObject * )mp ) > 0 );
274- int watcher_bits = mp -> ma_version_tag & DICT_WATCHER_MASK ;
249+ int watcher_bits = mp -> _ma_watcher_tag & DICT_WATCHER_MASK ;
275250 if (watcher_bits ) {
276251 RARE_EVENT_STAT_INC (watched_dict_modification );
277252 _PyDict_SendEvent (watcher_bits , event , mp , key , value );
278253 }
279- return DICT_NEXT_VERSION (interp ) | (mp -> ma_version_tag & DICT_WATCHER_AND_MODIFICATION_MASK );
280254}
281255
282256extern PyDictObject * _PyObject_MaterializeManagedDict (PyObject * obj );
0 commit comments