[Zope-dev] Re: Acquisition in Python2.5
On Jan 22, 2008 5:01 AM, Tres Seaver <[EMAIL PROTECTED]> wrote: > > Hanno Schlichting wrote: >> >> 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. > > > Under 2.5, that function isn't even called during the test. QED. > > It looks as though the only way out is to implement rich comparison > semantics (Python's 'do_cmp' prefers 'tp_richcompare' to 'tp_compare'). > Thanks for those hints. I will try to solve it by trying the above ways (although I am not much good at C api part at present). Regards, Nikhil ___ Zope-Dev maillist - Zope-Dev@zope.org http://mail.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope )
[Zope-dev] Re: Acquisition in Python2.5
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Tres Seaver wrote: > Hanno Schlichting wrote: > >> 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. > > Under 2.5, that function isn't even called during the test. QED. Crap. The Python maintainers decided to disallow heteragenous comparisons in C code: - http://mail.python.org/pipermail/patches/2004-December/016607.html which led to: - http://svn.python.org/view/python/trunk/Objects/object.c?r1=37435&r2=38113 It looks as though the only way out is to implement rich comparison semantics (Python's 'do_cmp' prefers 'tp_richcompare' to 'tp_compare'). Tres. - -- === Tres Seaver +1 540-429-0999 [EMAIL PROTECTED] 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 iD8DBQFHlStj+gerLs4ltQ4RAqDIAJwIL+1uEucXDOIFGJtsP6jP7khIqACeLV95 uf4ytGpv3fuUWO0gqx2vNhs= =yFps -END PGP SIGNATURE- ___ Zope-Dev maillist - Zope-Dev@zope.org http://mail.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope )
[Zope-dev] Re: Acquisition in Python2.5
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Hanno Schlichting wrote: > 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. Under 2.5, that function isn't even called during the test. QED. >> 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 [EMAIL PROTECTED] 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 iD8DBQFHlRBb+gerLs4ltQ4RAsWdAJ9ZSq23JfU8mD/dCLt7eatPlS4G+gCg2cqu fdb8A8+fAD5zgIygv/cL1Ks= =LZPR -END PGP SIGNATURE- ___ Zope-Dev maillist - Zope-Dev@zope.org http://mail.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope )
[Zope-dev] Re: Acquisition in Python2.5
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 "", line 1, in 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 ___ Zope-Dev maillist - Zope-Dev@zope.org http://mail.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope )
Re: [Zope-dev] Re: Acquisition in Python2.5
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Andreas Jung wrote: > > --On 21. Januar 2008 14:29:39 -0500 Tres Seaver <[EMAIL PROTECTED]> > wrote: > >> -BEGIN PGP SIGNED MESSAGE- >> Hash: SHA1 >> >> Andreas Jung wrote: >>> --On 21. Januar 2008 11:44:28 +0530 Nikhil N <[EMAIL PROTECTED]> >>> wrote: >>> Hello all , I am stuck with an error in Acquisition while trying to make Zope2 work in Python2.5. >>> Zope 2 does not support Python 2.5. Stick with the recommended >>> version Python 2.4.4. >> Andreas, Nikhil is the person working on 2.5 compabibility: don't blow >> him off! > > I did not know and I apologized already. Ah, sorry -- I missed seeing that part of the thread. Tres. - -- === Tres Seaver +1 540-429-0999 [EMAIL PROTECTED] 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 iD8DBQFHlP4B+gerLs4ltQ4RAsbsAJ96o5HqQN+/W5Y+zXPbnxkAl9k1BQCfU5zU ur9vwBgn8zrfK/ibge4EDhg= =QQgZ -END PGP SIGNATURE- ___ Zope-Dev maillist - Zope-Dev@zope.org http://mail.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope )
[Zope-dev] Re: Acquisition in Python2.5
-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 "", line 1, in 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 [EMAIL PROTECTED] 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- ___ Zope-Dev maillist - Zope-Dev@zope.org http://mail.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope )
Re: [Zope-dev] Re: Acquisition in Python2.5
--On 21. Januar 2008 14:29:39 -0500 Tres Seaver <[EMAIL PROTECTED]> wrote: -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Andreas Jung wrote: --On 21. Januar 2008 11:44:28 +0530 Nikhil N <[EMAIL PROTECTED]> wrote: Hello all , I am stuck with an error in Acquisition while trying to make Zope2 work in Python2.5. Zope 2 does not support Python 2.5. Stick with the recommended version Python 2.4.4. Andreas, Nikhil is the person working on 2.5 compabibility: don't blow him off! I did not know and I apologized already. Andreas pgpkDusM0IwmE.pgp Description: PGP signature ___ Zope-Dev maillist - Zope-Dev@zope.org http://mail.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope )
[Zope-dev] Re: Acquisition in Python2.5
-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. Does 2.5 define new "rich comparison" slots, or something? Tres. - -- === Tres Seaver +1 540-429-0999 [EMAIL PROTECTED] 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 iD8DBQFHlPOL+gerLs4ltQ4RAqdSAKDZJOMl0yHnIm68jXAl8PwUoy4iogCfU4OD owvenStnH4VgUeNvtPKQm5Y= =4bXw -END PGP SIGNATURE- ___ Zope-Dev maillist - Zope-Dev@zope.org http://mail.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope )
[Zope-dev] Re: Acquisition in Python2.5
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Andreas Jung wrote: > > --On 21. Januar 2008 11:44:28 +0530 Nikhil N <[EMAIL PROTECTED]> wrote: > >> Hello all , >> >> I am stuck with an error in Acquisition while trying to make >> Zope2 work in Python2.5. > > Zope 2 does not support Python 2.5. Stick with the recommended > version Python 2.4.4. Andreas, Nikhil is the person working on 2.5 compabibility: don't blow him off! Tres. - -- === Tres Seaver +1 540-429-0999 [EMAIL PROTECTED] 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 iD8DBQFHlPKj+gerLs4ltQ4RArfqAKCRXxRpwr1Ys73KsmVxSkSJBJJuoQCgzxyL eccoIDuP819JcOJFPQq0eCM= =Aqw4 -END PGP SIGNATURE- ___ Zope-Dev maillist - Zope-Dev@zope.org http://mail.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope )