summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2013-11-30 16:26:55 -0500
committerMike Bayer <mike_mp@zzzcomputing.com>2013-11-30 16:26:55 -0500
commit404b47a50c2c6f1685f696fe708abde8001afbbd (patch)
tree61ccb2345cb7b06bb8ead1e26504e2cc0acc6636
parent12b05adbb118b8501eb79abeb2c821e1a8f89ce9 (diff)
downloadsqlalchemy-404b47a50c2c6f1685f696fe708abde8001afbbd.tar.gz
- changelog
- put list.clear() instrumentation under "if not py2k"
-rw-r--r--doc/build/changelog/changelog_09.rst8
-rw-r--r--lib/sqlalchemy/orm/collections.py15
2 files changed, 16 insertions, 7 deletions
diff --git a/doc/build/changelog/changelog_09.rst b/doc/build/changelog/changelog_09.rst
index 158a14058..1f72d0f26 100644
--- a/doc/build/changelog/changelog_09.rst
+++ b/doc/build/changelog/changelog_09.rst
@@ -15,6 +15,14 @@
:version: 0.9.0b2
.. change::
+ :tags: bug, orm, collections, py3k
+ :pullreq: github:40
+
+ Added support for the Python 3 method ``list.clear()`` within
+ the ORM collection instrumentation system; pull request
+ courtesy Eduardo Schettino.
+
+ .. change::
:tags: bug, postgresql
:tickets: 2878
diff --git a/lib/sqlalchemy/orm/collections.py b/lib/sqlalchemy/orm/collections.py
index ffd0b8c37..b92b6954c 100644
--- a/lib/sqlalchemy/orm/collections.py
+++ b/lib/sqlalchemy/orm/collections.py
@@ -1161,13 +1161,14 @@ def _list_decorators():
_tidy(pop)
return pop
- def clear(fn):
- def clear(self, index=-1):
- for item in self:
- __del(self, item)
- fn(self)
- _tidy(clear)
- return clear
+ if not util.py2k:
+ def clear(fn):
+ def clear(self, index=-1):
+ for item in self:
+ __del(self, item)
+ fn(self)
+ _tidy(clear)
+ return clear
# __imul__ : not wrapping this. all members of the collection are already
# present, so no need to fire appends... wrapping it with an explicit