]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commitdiff
prevent strings from being treated as a valid iterable argument
authorOliver Rice <github@oliverrice.com>
Sat, 13 Feb 2021 00:12:41 +0000 (18:12 -0600)
committerOliver Rice <github@oliverrice.com>
Sat, 13 Feb 2021 00:12:41 +0000 (18:12 -0600)
lib/sqlalchemy/sql/selectable.py

index 24793ea2074f0d66c7e24c7d996882cb87cb2272..ba3ccdec043c6eb8879d4fc1c6cdc6cc21db52d5 100644 (file)
@@ -4870,7 +4870,11 @@ class Select(
           constructs as given, as well as ORM-mapped classes.
 
         """
-        if (args and hasattr(args[0], '__iter__')) or kw:
+        if (
+            args
+            and hasattr(args[0], "__iter__")
+            and not hasattr(args[0], "strip")
+        ) or kw:
             return cls.create_legacy_select(*args, **kw)
         else:
             return cls._create_future_select(*args)