summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy/util/langhelpers.py
diff options
context:
space:
mode:
Diffstat (limited to 'lib/sqlalchemy/util/langhelpers.py')
-rw-r--r--lib/sqlalchemy/util/langhelpers.py4
1 files changed, 3 insertions, 1 deletions
diff --git a/lib/sqlalchemy/util/langhelpers.py b/lib/sqlalchemy/util/langhelpers.py
index c2ebf7637..8815ed837 100644
--- a/lib/sqlalchemy/util/langhelpers.py
+++ b/lib/sqlalchemy/util/langhelpers.py
@@ -1024,7 +1024,9 @@ def coerce_kw_type(kw, key, type_, flexi_bool=True):
when coercing to boolean.
"""
- if key in kw and not isinstance(kw[key], type_) and kw[key] is not None:
+ if key in kw and (
+ not isinstance(type_, type) or not isinstance(kw[key], type_)
+ ) and kw[key] is not None:
if type_ is bool and flexi_bool:
kw[key] = asbool(kw[key])
else: