diff options
| author | Mike Bayer <mike_mp@zzzcomputing.com> | 2014-05-24 16:28:23 -0400 |
|---|---|---|
| committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2014-05-24 16:28:23 -0400 |
| commit | 4d4abd2f76acd0d4c427884708cc3b7f1baaaa3f (patch) | |
| tree | 55731609c74f2694e0bca845167365a7807c3a40 /lib/sqlalchemy/orm | |
| parent | b0b6f4295e6eb05ef708072104d4bc762722952a (diff) | |
| download | sqlalchemy-4d4abd2f76acd0d4c427884708cc3b7f1baaaa3f.tar.gz | |
- 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.
Diffstat (limited to 'lib/sqlalchemy/orm')
| -rw-r--r-- | lib/sqlalchemy/orm/state.py | 27 |
1 files changed, 8 insertions, 19 deletions
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) |
