Skip to content

armgit / zulip

Public Imported from GitHub
0

Zulip server and web application. Open-source team chat that helps teams stay productive and focused.

notes: Separate __notes_map per-subclass.

Anders Kaseorg6d1925687713
diff --git a/zerver/lib/notes.py b/zerver/lib/notes.py
index 690bf9b4cce..b46bbde7a0d 100644
--- a/zerver/lib/notes.py
+++ b/zerver/lib/notes.py
@@ -26,7 +26,12 @@ class BaseNotes(Generic[_KeyT, _DataT], metaclass=ABCMeta):
handle correctly.
"""
- __notes_map: ClassVar[MutableMapping[Any, Any]] = weakref.WeakKeyDictionary()
+ __notes_map: ClassVar[MutableMapping[Any, Any]]
+
+ def __init_subclass__(cls, **kwargs: object) -> None:
+ super().__init_subclass__(**kwargs)
+ if not hasattr(cls, "__notes_map"):
+ cls.__notes_map = weakref.WeakKeyDictionary()
@classmethod
def get_notes(cls, key: _KeyT) -> _DataT: