]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commit
add recursion check for with_loader_criteria() option
authorMike Bayer <mike_mp@zzzcomputing.com>
Wed, 22 Dec 2021 20:33:11 +0000 (15:33 -0500)
committerMike Bayer <mike_mp@zzzcomputing.com>
Wed, 22 Dec 2021 21:50:11 +0000 (16:50 -0500)
commite93459f578133e278bb0fe3e202bccb077cc2c59
treecc9b52292dfafda23ea8e6e4361e0af65cac2163
parenta0cfc934dc1286f24f3e769b305cf2faaa818302
add recursion check for with_loader_criteria() option

Fixed recursion overflow which could occur within ORM statement compilation
when using either the :func:`_orm.with_loader_criteria` feature or the the
:meth:`_orm.PropComparator.and_` method within a loader strategy in
conjunction with a subquery which referred to the same entity being altered
by the criteria option, or loaded by the loader strategy.  A check for
coming across the same loader criteria option in a recursive fashion has
been added to accommodate for this scenario.

Fixes: #7491
Change-Id: I8701332717c45a21948ea4788a3058c0fbbf03a7
(cherry picked from commit c66c6d1aeff92f838740b7745a9c2a47852949d6)
doc/build/changelog/unreleased_14/7491.rst [new file with mode: 0644]
lib/sqlalchemy/orm/context.py
lib/sqlalchemy/orm/util.py
lib/sqlalchemy/sql/annotation.py
test/orm/test_relationship_criteria.py