From 8fdce89f0677807fac2c3d059476dfb305a85812 Mon Sep 17 00:00:00 2001 From: Russell Hay Date: Tue, 12 Jul 2016 11:34:36 -0700 Subject: [PATCH] convert the indices to be weak ref value dictionaries --- tableaudocumentapi/multilookup_dict.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/tableaudocumentapi/multilookup_dict.py b/tableaudocumentapi/multilookup_dict.py index 39c92c6..21e2736 100644 --- a/tableaudocumentapi/multilookup_dict.py +++ b/tableaudocumentapi/multilookup_dict.py @@ -1,3 +1,6 @@ +import weakref + + def _resolve_value(key, value): try: retval = value.get(key, None) @@ -21,8 +24,8 @@ def __init__(self, args=None): args = {} super(MultiLookupDict, self).__init__(args) self._indexes = { - 'alias': {}, - 'caption': {} + 'alias': weakref.WeakValueDictionary(), + 'caption': weakref.WeakValueDictionary() } self._populate_indexes()