]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commitdiff
- Fixed regression from 0.9.10 prior to release due to :ticket:`3349`
authorMike Bayer <mike_mp@zzzcomputing.com>
Fri, 1 May 2015 01:26:48 +0000 (21:26 -0400)
committerMike Bayer <mike_mp@zzzcomputing.com>
Fri, 1 May 2015 01:26:48 +0000 (21:26 -0400)
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

doc/build/changelog/changelog_10.rst
lib/sqlalchemy/orm/persistence.py

index fe5c7a744779f7da7e6d6f3ba9c61eb43bf66f3d..09ffcddc9de5c17c9e466183041364d38500cb8e 100644 (file)
 .. changelog::
     :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.
index c3974ed6d0ce7d927c5042f714f7647498c22236..ab2d54d9016fa624c7a44dd7b7dd7e59e8fb2a1b 100644 (file)
@@ -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" %