]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commitdiff
- need to use safe_discard() at least in _restore_snapshot(), let's use it
authorMike Bayer <mike_mp@zzzcomputing.com>
Fri, 29 Aug 2014 20:32:08 +0000 (16:32 -0400)
committerMike Bayer <mike_mp@zzzcomputing.com>
Fri, 29 Aug 2014 20:32:08 +0000 (16:32 -0400)
everywhere in Session since the optimized one only applies to loading

lib/sqlalchemy/orm/session.py

index 52873eb34111ca8fb189c9ee757982ff80207887..13afcb35746012e9ff881673696c42468991dfcf 100644 (file)
@@ -269,7 +269,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)
 
@@ -1394,7 +1394,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:
@@ -1464,7 +1464,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