z.i.adapters.LookupBase.lookup1 inconsistent between Python and C implementations
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
zope.interface |
Fix Released
|
Undecided
|
Tres Seaver |
Bug Description
The reference implementation for lookup1 consistently returns the '_default'
if the value returned by 'lookup' is None; the C version only does so on the
first time through: after that, it returns the (cached) None. E.g.:
from zope.interface.
class Lookup(LookupBase):
def _uncached_
return None
lb = Lookup()
_default = object()
found = lb.lookup1('A', 'B', 'C', _default)
assert(found is _default) # OK both in C and Python
found = lb.lookup1('A', 'B', 'C', _default)
assert(found is _default) # OK in Python, fails in C
I will attaching a patch which fixes this problem. The patch, as well as
a testcase demonstrating the bug, are also in my branch:
Changed in zope.interface: | |
status: | Fix Committed → Fix Released |
Crap, make that branch::
lp:~tseaver/zope.interface/better_unittests