summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy/orm/identity.py
diff options
context:
space:
mode:
Diffstat (limited to 'lib/sqlalchemy/orm/identity.py')
-rw-r--r--lib/sqlalchemy/orm/identity.py8
1 files changed, 7 insertions, 1 deletions
diff --git a/lib/sqlalchemy/orm/identity.py b/lib/sqlalchemy/orm/identity.py
index 2da5d66b3..842b7915a 100644
--- a/lib/sqlalchemy/orm/identity.py
+++ b/lib/sqlalchemy/orm/identity.py
@@ -125,10 +125,13 @@ class WeakInstanceDict(IdentityMap):
if existing is not state:
self._manage_removed_state(existing)
else:
- return
+ return None
+ else:
+ existing = None
self._dict[state.key] = state
self._manage_incoming_state(state)
+ return existing
def add(self, state):
key = state.key
@@ -297,9 +300,12 @@ class StrongInstanceDict(IdentityMap):
self._manage_removed_state(existing)
else:
return
+ else:
+ existing = None
self._dict[state.key] = state.obj()
self._manage_incoming_state(state)
+ return existing
def add(self, state):
if state.key in self: