]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commit
refine in_() check to use proper duck-typing for __clause_element__
authorMike Bayer <mike_mp@zzzcomputing.com>
Mon, 21 Oct 2024 14:03:01 +0000 (10:03 -0400)
committerMichael Bayer <mike_mp@zzzcomputing.com>
Mon, 21 Oct 2024 18:00:29 +0000 (18:00 +0000)
commitf5225046b69262f1e5f28da84986e9d51dc7b609
treedc4c4c3c4694d254740c19039628a00d8f73e29b
parent978d3a4c066aefa9f2d93ecf935e52887bc28685
refine in_() check to use proper duck-typing for __clause_element__

Fixed regression caused by an internal code change in response to recent
Mypy releases that caused the very unusual case of a list of ORM-mapped
attribute expressions passed to :meth:`.ColumnOperators.in_` to no longer
be accepted.

in this commit we had to revisit d8dd28c42e where mypy typing
didn't accept ColumnOperartors.   the type here is the _HasClauseElement[_T]
protocol which means we need to use a duck type for a runtime check.

Fixes: #12019
Change-Id: Ib378e9cb8defb49d5ac4d726ec93d6bdc581b6a9
(cherry picked from commit aaddd7c8403e9ca2f77113467b5e2ae279a542c4)
doc/build/changelog/unreleased_20/12019.rst [new file with mode: 0644]
lib/sqlalchemy/sql/coercions.py
test/orm/test_query.py
test/sql/test_operators.py