]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commitdiff
need to test for (list, tuple) here and not hasattr("__iter__")
authorMike Bayer <mike_mp@zzzcomputing.com>
Fri, 26 Apr 2013 23:48:43 +0000 (19:48 -0400)
committerMike Bayer <mike_mp@zzzcomputing.com>
Fri, 26 Apr 2013 23:48:43 +0000 (19:48 -0400)
since Py3K strings have __iter__

lib/sqlalchemy/dialects/postgresql/base.py

index 5d9368893a36b807dd53d4749d8791f1e2355eda..1acdb57b9070297e091ca52fadadfcf37f0fc725 100644 (file)
@@ -673,7 +673,10 @@ class ARRAY(sqltypes.Concatenable, sqltypes.TypeEngine):
         if dim is None:
             arr = list(arr)
         if dim == 1 or dim is None and (
-                        not arr or not hasattr(arr[0], '__iter__')):
+                        # this has to be (list, tuple), or at least
+                        # not hasattr('__iter__'), since Py3K strings
+                        # etc. have __iter__
+                        not arr or not isinstance(arr[0], (list, tuple))):
             if itemproc:
                 return collection(itemproc(x) for x in arr)
             else: