summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--doc/build/changelog/changelog_10.rst12
-rw-r--r--lib/sqlalchemy/orm/persistence.py16
2 files changed, 19 insertions, 9 deletions
diff --git a/doc/build/changelog/changelog_10.rst b/doc/build/changelog/changelog_10.rst
index fe5c7a744..09ffcddc9 100644
--- a/doc/build/changelog/changelog_10.rst
+++ b/doc/build/changelog/changelog_10.rst
@@ -19,6 +19,16 @@
:version: 1.0.3
.. change::
+ :tags: bug, orm, pypy
+ :tickets: 3405
+
+ 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.
+
+ .. change::
:tags: feature, engine
:tickets: 3379
@@ -52,7 +62,7 @@
:tags: bug, orm
:tickets: 3403, 3320
- Fixed regression from as yet unreleased 0.9.10 where the new addition
+ Fixed regression from 0.9.10 prior to release where the new addition
of ``entity`` to the :attr:`.Query.column_descriptions` accessor
would fail if the target entity was produced from a core selectable
such as a :class:`.Table` or :class:`.CTE` object.
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" %