From 4d4abd2f76acd0d4c427884708cc3b7f1baaaa3f Mon Sep 17 00:00:00 2001 From: Mike Bayer Date: Sat, 24 May 2014 16:28:23 -0400 Subject: - revert the memoized committed_state / callables changes as they appear to add to lazy loading. not really clear which approach is better in the long run. --- lib/sqlalchemy/orm/state.py | 27 ++++++++------------------- 1 file changed, 8 insertions(+), 19 deletions(-) (limited to 'lib/sqlalchemy') diff --git a/lib/sqlalchemy/orm/state.py b/lib/sqlalchemy/orm/state.py index 7ff243e3b..6cf550f88 100644 --- a/lib/sqlalchemy/orm/state.py +++ b/lib/sqlalchemy/orm/state.py @@ -56,8 +56,6 @@ class InstanceState(interfaces._InspectionAttr): expired = False deleted = False _load_pending = False - committed_state = util.immutabledict() - callables = util.immutabledict() is_instance = True @@ -65,14 +63,8 @@ class InstanceState(interfaces._InspectionAttr): self.class_ = obj.__class__ self.manager = manager self.obj = weakref.ref(obj, self._cleanup) - - @util.memoized_property - def callables(self): - return {} - - @util.memoized_property - def committed_state(self): - return {} + self.committed_state = {} + self.callables = {} @util.memoized_property def attrs(self): @@ -230,8 +222,7 @@ class InstanceState(interfaces._InspectionAttr): if instance_dict: instance_dict.discard(self) - if 'callables' in self.__dict__: - del self.callables + self.callables.clear() self.session_id = self._strong_obj = None del self.obj @@ -569,17 +560,15 @@ class InstanceState(interfaces._InspectionAttr): for state, dict_ in iter: state_dict = state.__dict__ - if 'committed_state' in state_dict: - del state_dict['committed_state'] + state.committed_state.clear() if '_pending_mutations' in state_dict: del state_dict['_pending_mutations'] - if 'callables' in state_dict: - callables = state.callables - for key in list(callables): - if key in dict_ and callables[key] is state: - del callables[key] + callables = state.callables + for key in list(callables): + if key in dict_ and callables[key] is state: + del callables[key] if instance_dict and state.modified: instance_dict._modified.discard(state) -- cgit v1.2.1