summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy/orm
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2017-06-15 12:03:22 -0400
committerMike Bayer <mike_mp@zzzcomputing.com>2017-06-15 12:03:22 -0400
commit770e1e399cb0c91db73a551e1962ccbb57f42e76 (patch)
treed4803124576cc7f7c5422ad4e4571b09bb548744 /lib/sqlalchemy/orm
parent740f6b0d5ae3bda77f5c1829e9220d4ce9db8175 (diff)
downloadsqlalchemy-770e1e399cb0c91db73a551e1962ccbb57f42e76.tar.gz
Repair regression to pathing for subclasses
Issue #3963's initial commit narrowed the "current path" match rules too much such that a path that matches current path on subclass would no longer match. Change-Id: I8c9a0db91a09d789cfb8666288a913f8bbcdb2e9 Fixes: #3963
Diffstat (limited to 'lib/sqlalchemy/orm')
-rw-r--r--lib/sqlalchemy/orm/strategy_options.py9
1 files changed, 7 insertions, 2 deletions
diff --git a/lib/sqlalchemy/orm/strategy_options.py b/lib/sqlalchemy/orm/strategy_options.py
index d3f456969..4c7e34ebb 100644
--- a/lib/sqlalchemy/orm/strategy_options.py
+++ b/lib/sqlalchemy/orm/strategy_options.py
@@ -472,7 +472,7 @@ class _UnboundLoad(Load):
def _chop_path(self, to_chop, path):
i = -1
- for i, (c_token, (p_mapper, p_prop)) in enumerate(
+ for i, (c_token, (p_entity, p_prop)) in enumerate(
zip(to_chop, path.pairs())):
if isinstance(c_token, util.string_types):
if i == 0 and c_token.endswith(':' + _DEFAULT_TOKEN):
@@ -482,7 +482,12 @@ class _UnboundLoad(Load):
return None
elif isinstance(c_token, PropComparator):
if c_token.property is not p_prop or \
- c_token._parententity is not p_mapper:
+ (
+ c_token._parententity is not p_entity and (
+ not c_token._parententity.is_mapper or
+ not c_token._parententity.isa(p_entity)
+ )
+ ):
return None
else:
i += 1