From: Mike Bayer Date: Fri, 26 Apr 2013 23:48:43 +0000 (-0400) Subject: need to test for (list, tuple) here and not hasattr("__iter__") X-Git-Tag: rel_0_8_1~1^2~4 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=9a1c505d321b09a8cc4b7e16549f2023b60c247e;p=thirdparty%2Fsqlalchemy%2Fsqlalchemy.git need to test for (list, tuple) here and not hasattr("__iter__") since Py3K strings have __iter__ --- diff --git a/lib/sqlalchemy/dialects/postgresql/base.py b/lib/sqlalchemy/dialects/postgresql/base.py index 5d9368893a..1acdb57b90 100644 --- a/lib/sqlalchemy/dialects/postgresql/base.py +++ b/lib/sqlalchemy/dialects/postgresql/base.py @@ -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: