From aec57258b3b33fe070ebb54f31f1627db07f072b Mon Sep 17 00:00:00 2001 From: Mike Bayer Date: Sun, 8 Jul 2018 19:10:36 -0400 Subject: Check tokens in chop path for inspectionattr before calling is_mapper Fixed regression in 1.2.9 due to :ticket:`4287` where using a :class::`.Load` option in conjunction with a string wildcard would result in a TypeError. Change-Id: I2997ead0b8b9fa0edd009aa6f3161f4618fab97b Fixes: #4298 --- lib/sqlalchemy/orm/strategy_options.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'lib') diff --git a/lib/sqlalchemy/orm/strategy_options.py b/lib/sqlalchemy/orm/strategy_options.py index 90d14075c..af9bd71b6 100644 --- a/lib/sqlalchemy/orm/strategy_options.py +++ b/lib/sqlalchemy/orm/strategy_options.py @@ -13,7 +13,8 @@ from .attributes import QueryableAttribute from .. import util from ..sql.base import _generative, Generative from .. import exc as sa_exc, inspect -from .base import _is_aliased_class, _class_to_mapper, _is_mapped_class +from .base import _is_aliased_class, _class_to_mapper, _is_mapped_class, \ + InspectionAttr from . import util as orm_util from .path_registry import PathRegistry, TokenRegistry, \ _WILDCARD_TOKEN, _DEFAULT_TOKEN @@ -385,7 +386,8 @@ class Load(Generative, MapperOption): if c_token is p_token: continue - elif c_token.is_mapper and p_token.is_mapper and \ + elif isinstance(c_token, InspectionAttr) and \ + c_token.is_mapper and p_token.is_mapper and \ c_token.isa(p_token): continue else: -- cgit v1.2.1