summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy
diff options
context:
space:
mode:
authorPhilip Jenvey <pjenvey@underboss.org>2009-08-09 20:35:24 +0000
committerPhilip Jenvey <pjenvey@underboss.org>2009-08-09 20:35:24 +0000
commit7974625e8b86a28f3ac81c3c620df9b2801b133d (patch)
tree2a987b79a75dd0755c19fe30a08df93e9ffeb2d3 /lib/sqlalchemy
parenta53d4e2ab48a003a957ba374c65ea999dcd962e4 (diff)
downloadsqlalchemy-7974625e8b86a28f3ac81c3c620df9b2801b133d.tar.gz
pull from identity_map atomically to avoid a race with weakref cleanup
Diffstat (limited to 'lib/sqlalchemy')
-rw-r--r--lib/sqlalchemy/orm/mapper.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/sqlalchemy/orm/mapper.py b/lib/sqlalchemy/orm/mapper.py
index 177799602..dcf33d07e 100644
--- a/lib/sqlalchemy/orm/mapper.py
+++ b/lib/sqlalchemy/orm/mapper.py
@@ -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)