summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy/orm/context.py
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2022-01-03 17:28:52 -0500
committerMike Bayer <mike_mp@zzzcomputing.com>2022-01-03 17:39:33 -0500
commit709239f4a61e88c2051dce87eb4058efd653697e (patch)
tree5c9c3c15c7e13e422a2c61fca2ccd51ca6ee94b5 /lib/sqlalchemy/orm/context.py
parent400bf1716f84821d63daaf0a988d725dfd55d6a0 (diff)
downloadsqlalchemy-709239f4a61e88c2051dce87eb4058efd653697e.tar.gz
ensure correlate_except is checked for empty tuple
Fixed issue where :meth:`_sql.Select.correlate_except` method, when passed either the ``None`` value or no arguments, would not correlate any elements when used in an ORM context (that is, passing ORM entities as FROM clauses), rather than causing all FROM elements to be considered as "correlated" in the same way which occurs when using Core-only constructs. Fixes: #7514 Change-Id: Ic4a5252c8f3c1140aba6c308264948f3a91f33f5
Diffstat (limited to 'lib/sqlalchemy/orm/context.py')
-rw-r--r--lib/sqlalchemy/orm/context.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/sqlalchemy/orm/context.py b/lib/sqlalchemy/orm/context.py
index 7c2d72954..0c1d16d0e 100644
--- a/lib/sqlalchemy/orm/context.py
+++ b/lib/sqlalchemy/orm/context.py
@@ -774,7 +774,7 @@ class ORMSelectCompileState(ORMCompileState, SelectState):
for s in query._correlate
)
)
- elif query._correlate_except:
+ elif query._correlate_except is not None:
self.correlate_except = tuple(
util.flatten_iterator(
sql_util.surface_selectables(s) if s is not None else None
@@ -1192,7 +1192,7 @@ class ORMSelectCompileState(ORMCompileState, SelectState):
if correlate:
statement.correlate.non_generative(statement, *correlate)
- if correlate_except:
+ if correlate_except is not None:
statement.correlate_except.non_generative(
statement, *correlate_except
)