diff options
| author | Mike Bayer <mike_mp@zzzcomputing.com> | 2014-02-13 15:19:12 -0500 |
|---|---|---|
| committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2014-02-13 15:21:28 -0500 |
| commit | b87935ed4409cb57a88d5e84d4280d8f97be13ee (patch) | |
| tree | cc096b77e03edda72afc646c21a3e81add5643d6 /lib/sqlalchemy/sql | |
| parent | 50d60cfb994523176c26d3b25bd8fb282869b100 (diff) | |
| download | sqlalchemy-b87935ed4409cb57a88d5e84d4280d8f97be13ee.tar.gz | |
- Fixed bug where :meth:`.in_()` would go into an endless loop if
erroneously passed a column expression whose comparator included
the ``__getitem__()`` method, such as a column that uses the
:class:`.postgresql.ARRAY` type. [ticket:2957]
Diffstat (limited to 'lib/sqlalchemy/sql')
| -rw-r--r-- | lib/sqlalchemy/sql/expression.py | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/lib/sqlalchemy/sql/expression.py b/lib/sqlalchemy/sql/expression.py index 49b33bda6..287707c32 100644 --- a/lib/sqlalchemy/sql/expression.py +++ b/lib/sqlalchemy/sql/expression.py @@ -2618,14 +2618,18 @@ class _DefaultColumnComparator(operators.ColumnOperators): elif isinstance(seq_or_selectable, (Selectable, TextClause)): return self._boolean_compare(expr, op, seq_or_selectable, negate=negate_op, **kw) + elif isinstance(seq_or_selectable, ClauseElement): + raise exc.InvalidRequestError('in_() accepts' + ' either a list of expressions ' + 'or a selectable: %r' % seq_or_selectable) # Handle non selectable arguments as sequences args = [] for o in seq_or_selectable: if not _is_literal(o): if not isinstance(o, ColumnOperators): - raise exc.InvalidRequestError('in() function accept' - 's either a list of non-selectable values, ' + raise exc.InvalidRequestError('in_() accepts' + ' either a list of expressions ' 'or a selectable: %r' % o) elif o is None: o = null() |
