diff options
author | Mike Bayer <mike_mp@zzzcomputing.com> | 2023-04-02 14:24:32 -0400 |
---|---|---|
committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2023-04-02 14:24:32 -0400 |
commit | e79ab08165e01dc7af50fcffadb31468ace51b6c (patch) | |
tree | 43961bb056e9f0b0c7069bf3e5dea533dccd2c8f /lib/sqlalchemy/orm/path_registry.py | |
parent | 0108d1769830c9e4e95f2250d2f382476ee90de6 (diff) | |
download | sqlalchemy-e79ab08165e01dc7af50fcffadb31468ace51b6c.tar.gz |
consider aliased mappers in cycles also
Fixed endless loop which could occur when using "relationship to aliased
class" feature and also indicating a recursive eager loader such as
``lazy="selectinload"`` in the loader, in combination with another eager
loader on the opposite side. The check for cycles has been fixed to include
aliased class relationships.
Fixes: #9590
Change-Id: I8d340882f040ff9289c209bedd8fbdfd7186f944
Diffstat (limited to 'lib/sqlalchemy/orm/path_registry.py')
-rw-r--r-- | lib/sqlalchemy/orm/path_registry.py | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/sqlalchemy/orm/path_registry.py b/lib/sqlalchemy/orm/path_registry.py index b117f59f7..e7084fbf6 100644 --- a/lib/sqlalchemy/orm/path_registry.py +++ b/lib/sqlalchemy/orm/path_registry.py @@ -231,7 +231,7 @@ class PathRegistry(HasCacheKey): def contains_mapper(self, mapper: Mapper[Any]) -> bool: _m_path = cast(_OddPathRepresentation, self.path) for path_mapper in [_m_path[i] for i in range(0, len(_m_path), 2)]: - if path_mapper.is_mapper and path_mapper.isa(mapper): + if path_mapper.mapper.isa(mapper): return True else: return False |