summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy
diff options
context:
space:
mode:
Diffstat (limited to 'lib/sqlalchemy')
-rw-r--r--lib/sqlalchemy/orm/strategies.py3
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/sqlalchemy/orm/strategies.py b/lib/sqlalchemy/orm/strategies.py
index 3c156b70f..1962a7e2d 100644
--- a/lib/sqlalchemy/orm/strategies.py
+++ b/lib/sqlalchemy/orm/strategies.py
@@ -368,7 +368,8 @@ class LazyLoader(AbstractRelationLoader):
# use the "committed" (database) version to get query column values
# also its a deferred value; so that when used by Query, the committed value is used
# after an autoflush occurs
- bindparam.value = lambda: mapper._get_committed_state_attr_by_column(state, bind_to_col[bindparam.key])
+ o = state.obj() # strong ref
+ bindparam.value = lambda: mapper._get_committed_attr_by_column(o, bind_to_col[bindparam.key])
if self.parent_property.secondary and alias_secondary:
criterion = sql_util.ClauseAdapter(self.parent_property.secondary.alias()).traverse(criterion)