summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy/sql
diff options
context:
space:
mode:
Diffstat (limited to 'lib/sqlalchemy/sql')
-rw-r--r--lib/sqlalchemy/sql/coercions.py6
1 files changed, 4 insertions, 2 deletions
diff --git a/lib/sqlalchemy/sql/coercions.py b/lib/sqlalchemy/sql/coercions.py
index 2cf67abed..eef5cf211 100644
--- a/lib/sqlalchemy/sql/coercions.py
+++ b/lib/sqlalchemy/sql/coercions.py
@@ -759,9 +759,11 @@ class BinaryElementImpl(ExpressionElementImpl, RoleImpl):
except exc.ArgumentError as err:
self._raise_for_expected(element, err=err)
- def _post_coercion(self, resolved, expr, **kw):
+ def _post_coercion(self, resolved, expr, bindparam_type=None, **kw):
if resolved.type._isnull and not expr.type._isnull:
- resolved = resolved._with_binary_element_type(expr.type)
+ resolved = resolved._with_binary_element_type(
+ bindparam_type if bindparam_type is not None else expr.type
+ )
return resolved