File tree Expand file tree Collapse file tree 1 file changed +8
-6
lines changed Expand file tree Collapse file tree 1 file changed +8
-6
lines changed Original file line number Diff line number Diff line change @@ -645,28 +645,30 @@ Object Protocol
645645 PyMutex mutex;
646646
647647 PyObject *
648- add_entry (weakmap_key_type *key, PyObject * value)
648+ add_entry (weakmap_key_type *key, PyObject * value)
649649 {
650650 PyUnstable_EnableTryIncRef(value);
651651 weakmap_type weakmap = ...;
652+ PyMutex_Lock(&mutex);
652653 weakmap_add_entry(weakmap, key, value);
654+ PyMutex_Unlock(&mutex);
653655 Py_RETURN_NONE;
654656 }
655657
656658 PyObject *
657659 get_value(weakmap_key_type *key)
658660 {
659661 weakmap_type weakmap = ...;
660- PyMutex_Lock(mutex);
662+ PyMutex_Lock(& mutex);
661663 PyObject *result = weakmap_find(weakmap, key);
662664 if (PyUnstable_TryIncRef(result)) {
663665 // `result` is safe to use
664- PyMutex_Unlock(mutex);
666+ PyMutex_Unlock(& mutex);
665667 return result;
666668 }
667669 // if we get here, `result` is starting to be garbage-collected,
668670 // but has not been removed from the weakmap yet
669- PyMutex_Unlock(mutex);
671+ PyMutex_Unlock(& mutex);
670672 return NULL;
671673 }
672674
@@ -675,11 +677,11 @@ Object Protocol
675677 value_dealloc(PyObject *value)
676678 {
677679 weakmap_type weakmap = ...;
678- PyMutex_Lock(mutex);
680+ PyMutex_Lock(& mutex);
679681 weakmap_remove_value(weakmap, value);
680682
681683 ...
682- PyMutex_Unlock(mutex);
684+ PyMutex_Unlock(& mutex);
683685 }
684686
685687 .. versionadded :: 3.14
You can’t perform that action at this time.
0 commit comments