From 6b204274c02a8acb07cb23b7e048e89096d0b96a Mon Sep 17 00:00:00 2001 From: Damien Elmes Date: Thu, 5 Mar 2020 09:45:51 +1000 Subject: [PATCH] fix retain cycle caused by col.tr We can't use a weakref.proxy with a method, so manually proxy the call instead. --- pylib/anki/collection.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/pylib/anki/collection.py b/pylib/anki/collection.py index bd5795024..a7d159c73 100644 --- a/pylib/anki/collection.py +++ b/pylib/anki/collection.py @@ -83,7 +83,6 @@ class _Collection: log: bool = False, ) -> None: self.backend = backend - self.tr = backend.translate self._debugLog = log self.db = db self.path = db._path @@ -112,6 +111,9 @@ class _Collection: n = os.path.splitext(os.path.basename(self.path))[0] return n + def tr(self, key: TR, **kwargs: Union[str, int, float]) -> str: + return self.backend.translate(key, **kwargs) + # Scheduler ##########################################################################