Wrapper_iter does not clear error on success
Bug #1155760 reported by
Federico G. Schwindt
This bug affects 1 person
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Acquisition |
Fix Released
|
Undecided
|
Tres Seaver |
Bug Description
_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:
except AttributeError:
raise
To fix it simply add the missing PyErr_Clear() after if (PySequence_
To post a comment you must log in.
Thanks for the report. Test and fix pushed for the 4.0.1 release of Acquisition:
https:/ /github. com/zopefoundat ion/Acquisition /commit/ 7b5c5fd19d6672d f4573137487da81 8c45827b0f