diff options
author | Mike Bayer <mike_mp@zzzcomputing.com> | 2011-09-09 16:11:13 -0400 |
---|---|---|
committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2011-09-09 16:11:13 -0400 |
commit | d2bd1395c65b2c298a1deef54fd1d04bbf54697f (patch) | |
tree | 5f6b472be691d16da11ff19f062832475edfddd6 | |
parent | 840aab3beacdd1fe2a000dcd761d0514035cff94 (diff) | |
download | sqlalchemy-d2bd1395c65b2c298a1deef54fd1d04bbf54697f.tar.gz |
- Identity map .discard() uses dict.pop(,None)
internally instead of "del" to avoid KeyError/warning
during a non-determinate gc teardown [ticket:2267]
-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): |