From 9a1c505d321b09a8cc4b7e16549f2023b60c247e Mon Sep 17 00:00:00 2001 From: Mike Bayer Date: Fri, 26 Apr 2013 19:48:43 -0400 Subject: [PATCH] need to test for (list, tuple) here and not hasattr("__iter__") since Py3K strings have __iter__ --- lib/sqlalchemy/dialects/postgresql/base.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) 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: -- 2.47.2