From 7d2a581a58e9ca4ffbcb39a384ba6950a966de7a Mon Sep 17 00:00:00 2001 From: Mike Bayer Date: Mon, 25 Jun 2018 00:23:54 -0400 Subject: Compare mappers more accurately in Load._chop_path Fixed bug in cache key generation for baked queries which could cause a too-short cache key to be generated for the case of eager loads across subclasses. This could in turn cause the eagerload query to be cached in place of a non-eagerload query, or vice versa, for a polymorhic "selectin" load, or possibly for lazy loads or selectin loads as well. Change-Id: I2a69349d3e38814e2c7e6012fc04fbc0e47658a4 Fixes: #4287 --- lib/sqlalchemy/orm/strategy_options.py | 3 +++ 1 file changed, 3 insertions(+) (limited to 'lib/sqlalchemy') diff --git a/lib/sqlalchemy/orm/strategy_options.py b/lib/sqlalchemy/orm/strategy_options.py index f54020fb7..90d14075c 100644 --- a/lib/sqlalchemy/orm/strategy_options.py +++ b/lib/sqlalchemy/orm/strategy_options.py @@ -385,6 +385,9 @@ class Load(Generative, MapperOption): if c_token is p_token: continue + elif c_token.is_mapper and p_token.is_mapper and \ + c_token.isa(p_token): + continue else: return None return to_chop[i + 1:] -- cgit v1.2.1