summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy/orm
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2015-04-30 21:26:48 -0400
committerMike Bayer <mike_mp@zzzcomputing.com>2015-04-30 21:26:48 -0400
commit681276b5b4ae48924c85a1c26af3f9bde3d77b5f (patch)
tree1635821dd723234ffd05834f23e059bf0e714ea4 /lib/sqlalchemy/orm
parent4992aafecceb7a6301cfa4926bc709c873f37cc7 (diff)
downloadsqlalchemy-681276b5b4ae48924c85a1c26af3f9bde3d77b5f.tar.gz
- Fixed regression from 0.9.10 prior to release due to :ticket:`3349`
where the check for query state on :meth:`.Query.update` or :meth:`.Query.delete` compared the empty tuple to itself using ``is``, which fails on Pypy to produce ``True`` in this case; this would erronously emit a warning in 0.9 and raise an exception in 1.0. fixes #3405
Diffstat (limited to 'lib/sqlalchemy/orm')
-rw-r--r--lib/sqlalchemy/orm/persistence.py16
1 files changed, 8 insertions, 8 deletions
diff --git a/lib/sqlalchemy/orm/persistence.py b/lib/sqlalchemy/orm/persistence.py
index c3974ed6d..ab2d54d90 100644
--- a/lib/sqlalchemy/orm/persistence.py
+++ b/lib/sqlalchemy/orm/persistence.py
@@ -1034,18 +1034,18 @@ class BulkUD(object):
self._validate_query_state()
def _validate_query_state(self):
- for attr, methname, notset in (
- ('_limit', 'limit()', None),
- ('_offset', 'offset()', None),
- ('_order_by', 'order_by()', False),
- ('_group_by', 'group_by()', False),
- ('_distinct', 'distinct()', False),
+ for attr, methname, notset, op in (
+ ('_limit', 'limit()', None, operator.is_),
+ ('_offset', 'offset()', None, operator.is_),
+ ('_order_by', 'order_by()', False, operator.is_),
+ ('_group_by', 'group_by()', False, operator.is_),
+ ('_distinct', 'distinct()', False, operator.is_),
(
'_from_obj',
'join(), outerjoin(), select_from(), or from_self()',
- ())
+ (), operator.eq)
):
- if getattr(self.query, attr) is not notset:
+ if not op(getattr(self.query, attr), notset):
raise sa_exc.InvalidRequestError(
"Can't call Query.update() or Query.delete() "
"when %s has been called" %