[Zope-Checkins] SVN: Zope/branches/2.11/lib/python/Acquisition/ backport r99191 to 2.11

Andreas Zeidler az at zitc.de
Wed Apr 15 10:44:18 EDT 2009


Log message for revision 99192:
  backport r99191 to 2.11

Changed:
  U   Zope/branches/2.11/lib/python/Acquisition/_Acquisition.c
  U   Zope/branches/2.11/lib/python/Acquisition/tests.py

-=-
Modified: Zope/branches/2.11/lib/python/Acquisition/_Acquisition.c
===================================================================
--- Zope/branches/2.11/lib/python/Acquisition/_Acquisition.c	2009-04-15 14:36:02 UTC (rev 99191)
+++ Zope/branches/2.11/lib/python/Acquisition/_Acquisition.c	2009-04-15 14:44:17 UTC (rev 99192)
@@ -822,7 +822,7 @@
 static PyObject * 
 Wrapper_iter(Wrapper *self)
 {
-  return CallMethodO(OBJECT(self), py__iter__, NULL, NULL); 
+  return PyObject_GetIter(self->obj);
 }
 
 static PySequenceMethods Wrapper_as_sequence = {

Modified: Zope/branches/2.11/lib/python/Acquisition/tests.py
===================================================================
--- Zope/branches/2.11/lib/python/Acquisition/tests.py	2009-04-15 14:36:02 UTC (rev 99191)
+++ Zope/branches/2.11/lib/python/Acquisition/tests.py	2009-04-15 14:44:17 UTC (rev 99192)
@@ -1719,6 +1719,26 @@
     iterating...
     [42]
 
+    Finally let's check that https://bugs.launchpad.net/zope2/+bug/360761
+    has been fixed:
+
+    >>> class C(Acquisition.Implicit):
+    ...     l=[1,2,3]
+    ...     def __getitem__(self, i):
+    ...         return self.l[i]
+
+    >>> c1 = C()
+    >>> type(iter(c1))
+    <type 'iterator'>
+    >>> list(c1)
+    [1, 2, 3]
+
+    >>> c2 = C().__of__(c1)
+    >>> type(iter(c2))
+    <type 'iterator'>
+    >>> list(c2)
+    [1, 2, 3]
+
     """
 
 



More information about the Zope-Checkins mailing list