]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commitdiff
pull from identity_map atomically to avoid a race with weakref cleanup
authorPhilip Jenvey <pjenvey@underboss.org>
Sun, 9 Aug 2009 20:35:24 +0000 (20:35 +0000)
committerPhilip Jenvey <pjenvey@underboss.org>
Sun, 9 Aug 2009 20:35:24 +0000 (20:35 +0000)
lib/sqlalchemy/orm/mapper.py

index 177799602f423e9f822cf42130d0778d18d146ab..dcf33d07eb66116de63b80288e9f8449dc5671fe 100644 (file)
@@ -1629,8 +1629,8 @@ class Mapper(object):
             else:
                 identitykey = identity_key(row)
 
-            if identitykey in session_identity_map:
-                instance = session_identity_map[identitykey]
+            instance = session_identity_map.get(identitykey)
+            if instance is not None:
                 state = attributes.instance_state(instance)
                 dict_ = attributes.instance_dict(instance)