[Checkins] SVN: zope.proxy/trunk/ Back out support for __reversed__.

Tres Seaver cvs-admin at zope.org
Wed Jun 6 20:13:13 UTC 2012


Log message for revision 126622:
  Back out support for __reversed__.
  
  Python 2.7 adds B&D checks which break for the C wrapper.

Changed:
  _U  zope.proxy/trunk/
  U   zope.proxy/trunk/src/zope/proxy/__init__.py
  U   zope.proxy/trunk/src/zope/proxy/tests/test_proxy.py

-=-
Modified: zope.proxy/trunk/src/zope/proxy/__init__.py
===================================================================
--- zope.proxy/trunk/src/zope/proxy/__init__.py	2012-06-06 20:13:06 UTC (rev 126621)
+++ zope.proxy/trunk/src/zope/proxy/__init__.py	2012-06-06 20:13:10 UTC (rev 126622)
@@ -137,8 +137,9 @@
         # Called when we wrap an iterator itself.
         return self._wrapped.next()
 
-    def __reversed__(self):
-        return reversed(self._wrapped)
+    # Python 2.7 won't let the C wrapper support __reversed__ :(
+    #def __reversed__(self):
+    #    return reversed(self._wrapped)
 
     def __contains__(self, item):
         return item in self._wrapped

Modified: zope.proxy/trunk/src/zope/proxy/tests/test_proxy.py
===================================================================
--- zope.proxy/trunk/src/zope/proxy/tests/test_proxy.py	2012-06-06 20:13:06 UTC (rev 126621)
+++ zope.proxy/trunk/src/zope/proxy/tests/test_proxy.py	2012-06-06 20:13:10 UTC (rev 126622)
@@ -341,9 +341,10 @@
             b.append(x)
         self.assertEqual(a, b)
 
-    def test___reversed__(self):
-        w = self._makeOne([0, 1, 2, 3])
-        self.assertEqual(list(reversed(w)), [3, 2, 1, 0])
+    # Python 2.7 won't let the C wrapper support __reversed__ :(
+    #def test___reversed__(self):
+    #    w = self._makeOne([0, 1, 2, 3])
+    #    self.assertEqual(list(reversed(w)), [3, 2, 1, 0])
 
     def test___contains__(self):
         w = self._makeOne([0, 1, 2, 3])
@@ -1020,6 +1021,9 @@
                 return 'FOO'
             def what(self):
                 return 'FOO'
+        p0 = ProxyBase(Foo())
+        self.assertEqual(p0.who(), 'FOO')
+        self.assertEqual(p0.what(), 'FOO')
         proxy = Proxy(Foo())
         self.assertEqual(proxy.who(), 'FOO')
         self.assertEqual(proxy.what(), 'PROXY')



More information about the checkins mailing list