From a16687b3fc4179e8f42d8099aa6d1e6d18fedf70 Mon Sep 17 00:00:00 2001 From: Mike Bayer Date: Fri, 2 Apr 2021 11:06:28 -0400 Subject: Ensure Grouping._with_binary_element_type() maintains class Fixed regression where use of the :meth:`.Operators.in_` method with a :class:`_sql.Select` object against a non-table-bound column would produce an ``AttributeError``, or more generally using a :class:`_sql.ScalarSelect` that has no datatype in a binary expression would produce invalid state. Fixes: #6181 Change-Id: I1ddea433b3603fdab8f489bff571b512a6ffc66b --- lib/sqlalchemy/sql/elements.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib/sqlalchemy/sql/elements.py') diff --git a/lib/sqlalchemy/sql/elements.py b/lib/sqlalchemy/sql/elements.py index 7a27690b8..c48338303 100644 --- a/lib/sqlalchemy/sql/elements.py +++ b/lib/sqlalchemy/sql/elements.py @@ -3764,7 +3764,7 @@ class Grouping(GroupedElement, ColumnElement): self.type = getattr(element, "type", type_api.NULLTYPE) def _with_binary_element_type(self, type_): - return Grouping(self.element._with_binary_element_type(type_)) + return self.__class__(self.element._with_binary_element_type(type_)) @util.memoized_property def _is_implicitly_boolean(self): -- cgit v1.2.1