diff options
| author | Mike Bayer <mike_mp@zzzcomputing.com> | 2016-02-21 20:52:43 -0500 |
|---|---|---|
| committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2016-02-21 20:52:43 -0500 |
| commit | 01809bddff5b6e93010eb139aed54526c6e6c058 (patch) | |
| tree | e8a31670e7dffdce04802de112edc2f7ea563e1c /lib/sqlalchemy/util/_collections.py | |
| parent | 6713817e1186cd1e36c9aea9d89a30bc299ffe27 (diff) | |
| download | sqlalchemy-01809bddff5b6e93010eb139aed54526c6e6c058.tar.gz | |
- Fixed bug in "to_list" conversion where a single bytes object
would be turned into a list of individual characters. This would
impact among other things using the :meth:`.Query.get` method
on a primary key that's a bytes object.
fixes #3660
Diffstat (limited to 'lib/sqlalchemy/util/_collections.py')
| -rw-r--r-- | lib/sqlalchemy/util/_collections.py | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/lib/sqlalchemy/util/_collections.py b/lib/sqlalchemy/util/_collections.py index ed1a3e471..c29b81f6a 100644 --- a/lib/sqlalchemy/util/_collections.py +++ b/lib/sqlalchemy/util/_collections.py @@ -10,7 +10,8 @@ from __future__ import absolute_import import weakref import operator -from .compat import threading, itertools_filterfalse, string_types +from .compat import threading, itertools_filterfalse, string_types, \ + binary_types from . import py2k import types import collections @@ -794,7 +795,8 @@ def coerce_generator_arg(arg): def to_list(x, default=None): if x is None: return default - if not isinstance(x, collections.Iterable) or isinstance(x, string_types): + if not isinstance(x, collections.Iterable) or \ + isinstance(x, string_types + binary_types): return [x] elif isinstance(x, list): return x |
