diff options
author | Mike Bayer <mike_mp@zzzcomputing.com> | 2014-09-02 15:05:32 -0400 |
---|---|---|
committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2014-09-02 15:05:32 -0400 |
commit | 7e0c2241627090939df4ffdf71a09747fd599158 (patch) | |
tree | 3f646ef1b214af7dcff94e27e1d57ac6bf882b44 /lib/sqlalchemy/orm/session.py | |
parent | db70b6e79e263c137f4d282c9c600417636afa25 (diff) | |
parent | 613d8ca0f84d3e92b35403eaba21824e72b8ada8 (diff) | |
download | sqlalchemy-7e0c2241627090939df4ffdf71a09747fd599158.tar.gz |
Merge branch 'master' into ticket_3100
Diffstat (limited to 'lib/sqlalchemy/orm/session.py')
-rw-r--r-- | lib/sqlalchemy/orm/session.py | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/lib/sqlalchemy/orm/session.py b/lib/sqlalchemy/orm/session.py index 968868e84..e075b9c71 100644 --- a/lib/sqlalchemy/orm/session.py +++ b/lib/sqlalchemy/orm/session.py @@ -271,7 +271,7 @@ class SessionTransaction(object): del s.key for s, (oldkey, newkey) in self._key_switches.items(): - self.session.identity_map.discard(s) + self.session.identity_map.safe_discard(s) s.key = oldkey self.session.identity_map.replace(s) @@ -1397,7 +1397,7 @@ class Session(_SessionClassMethods): self._new.pop(state) state._detach() elif self.identity_map.contains_state(state): - self.identity_map.discard(state) + self.identity_map.safe_discard(state) self._deleted.pop(state, None) state._detach() elif self.transaction: @@ -1430,10 +1430,10 @@ class Session(_SessionClassMethods): if state.key is None: state.key = instance_key elif state.key != instance_key: - # primary key switch. use discard() in case another + # primary key switch. use safe_discard() in case another # state has already replaced this one in the identity # map (see test/orm/test_naturalpks.py ReversePKsTest) - self.identity_map.discard(state) + self.identity_map.safe_discard(state) if state in self.transaction._key_switches: orig_key = self.transaction._key_switches[state][0] else: @@ -1467,7 +1467,7 @@ class Session(_SessionClassMethods): if self._enable_transaction_accounting and self.transaction: self.transaction._deleted[state] = True - self.identity_map.discard(state) + self.identity_map.safe_discard(state) self._deleted.pop(state, None) state.deleted = True |