]> 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)
committerMike Bayer <mike_mp@zzzcomputing.com>
Mon, 21 Oct 2024 14:19:27 +0000 (10:19 -0400)
commitaaddd7c8403e9ca2f77113467b5e2ae279a542c4
tree600d751c15ac6791f8d4e22aa4f7a8f7380bcbc9
parent7495b51f9ae53b3a5c631d38397f5b9fece52015
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
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