[Zope-dev] Re: Acquisition in Python2.5

Hanno Schlichting plone at hannosch.info
Mon Jan 21 15:47:24 EST 2008


Tres Seaver wrote:
> Nikhil N wrote:
> Hmm, very strange.  I just did:

I used:

$ workingenv aq
$ source aq/bin/activate
$ easy_install Acquisition
$ python

For both Python 2.4 and 2.5 and can reproduce the problem.

>  >>> from ExtensionClass import Base
>  >>> from Acquisition import Implicit
>  >>> class B(Base):
>  ...     color = 'red'
>  ...
>  >>> class A(Implicit):
>  ...     pass
>  ...
>  >>> b = B()
>  >>> c = A()
>  >>> c.color
>  Traceback (most recent call last):
>    File "<stdin>", line 1, in <module>
>  AttributeError: color
>  >>> b.c = c
>  >>> b.c.color
>  'red'
>  >>> b.c == c
>  False

When I do:

 >>> b.c.aq_base == c
True

So the AQ-wrapper doesn't compare equal to the outermost part of the AQ 
chain anymore.

> which is what you reported.  However, two wrappers constructed
> separately do compare equal:
> 
>  >>> a = A().__of__(b)
>  >>> a.color
>  'red'
>  >>> b.a = a
>  >>> b.a == a
>  True

Two wrappers compare equal, so the code comparing an AQ wrapper with 
something different should be the one with the problem. I'd look into 
Wrapper_compare in _Acquisition.c.

> The Python 2.5 release notes don't talk about any changes to comparison
> slots for C extensions: I'm not sure what could have changed.

No idea either :(

Hanno



More information about the Zope-Dev mailing list