diff options
-rw-r--r-- | CHANGES | 4 | ||||
-rw-r--r-- | lib/sqlalchemy/orm/identity.py | 4 |
2 files changed, 6 insertions, 2 deletions
@@ -15,6 +15,10 @@ CHANGES when the Session.is_active is True. [ticket:2241] + - Identity map .discard() uses dict.pop(,None) + internally instead of "del" to avoid KeyError/warning + during a non-determinate gc teardown [ticket:2267] + - Fixed regression in new composite rewrite where deferred=True option failed due to missing import [ticket:2253] diff --git a/lib/sqlalchemy/orm/identity.py b/lib/sqlalchemy/orm/identity.py index 8f000e419..136bb7f01 100644 --- a/lib/sqlalchemy/orm/identity.py +++ b/lib/sqlalchemy/orm/identity.py @@ -193,7 +193,7 @@ class WeakInstanceDict(IdentityMap): def discard(self, state): st = dict.get(self, state.key, None) if st is state: - dict.__delitem__(self, state.key) + dict.pop(self, state.key, None) self._manage_removed_state(state) def prune(self): @@ -234,7 +234,7 @@ class StrongInstanceDict(IdentityMap): if obj is not None: st = attributes.instance_state(obj) if st is state: - dict.__delitem__(self, state.key) + dict.pop(self, state.key, None) self._manage_removed_state(state) def prune(self): |