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

Tres Seaver tseaver at palladion.com
Mon Jan 21 15:00:44 EST 2008


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Nikhil N wrote:
> Hello all ,
> 
> I am stuck with an error in Acquisition while trying to make
> Zope2 work in Python2.5. I reduced the errors obtained
> to those as follows (its not exactly as in the code, but a
> minimum set which shows the problem).
> 
>  from ExtensionClass import Base
>  import Acquisition
>  class B(Base):
>     color='red'
>  class A(Acquisition.Implicit):
>     pass
>  b=B()
>  c = A()
>  b.c = c
>  print b.c == c
> 
> When the last print statement should return true (2.4) ,in
> 2.5 its returning false. Please give some hint on this.

Hmm, very strange.  I just did:

 $ uname -a
 Linux seabiscuit 2.6.22-14-generic #1 SMP \
   Tue Dec 18 08:02:57 UTC 2007 i686 GNU/Linux
 $ python -V
 Python 2.5.1
 $ cd ~/projects/Zope-CVS/Zope-trunk
 $ svn up
 ...
 $ python setup.py install --home=/home/tseaver/tmp/zpy25
 ...
 (error on installing a script, but all libraries installed)
 $ cd ~/tmp/zpy25/
 $ PYTHONPATH=lib/python/ python
 Python 2.5.1 (r251:54863, Oct  5 2007, 13:36:32)
 [GCC 4.1.3 20070929 (prerelease) (Ubuntu 4.1.2-16ubuntu2)] on linux2
 Type "help", "copyright", "credits" or "license" for more information.
 >>> 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

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

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.


Tres.
- --
===================================================================
Tres Seaver          +1 540-429-0999          tseaver at palladion.com
Palladion Software   "Excellence by Design"    http://palladion.com
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFHlPns+gerLs4ltQ4RAlklAJ4rSe30Shrcbk/bQolzNCOQhq6UkgCg1lDo
hvA3QNJP7nFF67dBWypmWxI=
=J+x5
-----END PGP SIGNATURE-----



More information about the Zope-Dev mailing list