[zope2-tracker] [Bug 1155760] [NEW] Wrapper_iter does not clear error on success

Federico Schwindt federico.schwindt at gmail.com
Fri Mar 15 19:45:52 UTC 2013


Public bug reported:

_Acquisition.c's Wrapper_iter() doesn't call PyErr_Clear() if PyObject_GetAttr() failed but PySequence_Check() succeeded.
This causes mysterious "AttributeError: __iter__" on otherwise valid code. 

The following example shows the issue:

from Acquisition import Implicit
class C(Implicit):
    l = [0, 1, 2, 3, 4]
    def __getitem__(self, i):
        return self.l[i]
a = C()
b = C().__of__(a)
import time
try:
    for n in b:
        time.gmtime()
except AttributeError:
    raise

To fix it simply add the missing PyErr_Clear() after if
(PySequence_Check(obj)).

** Affects: zope2
     Importance: Undecided
         Status: New

-- 
You received this bug notification because you are a member of Zope 2
Developers, which is subscribed to Zope 2.
https://bugs.launchpad.net/bugs/1155760

Title:
  Wrapper_iter does not clear error on success

To manage notifications about this bug go to:
https://bugs.launchpad.net/zope2/+bug/1155760/+subscriptions


More information about the zope2-tracker mailing list