[Zope-Coders] Re: BTrees, Unicode, and Python 2.2

Andreas Jung Andreas Jung" <andreas@zope.com
Thu, 18 Oct 2001 13:20:08 -0400


I tracked the problem down to the TEST_KEY macro in
BucketTemplace.c/bucket_get().
TEST_KEY is only a macro for PyObject_Compare(). Putting PyObject_Compare
inside
a wrapper function shows me that it returns -1 (instead of 0) when trying to
compare
u'dreit\xe4gigen' with u'dreit\xe4gigen'.

Andreas
----- Original Message -----
From: "Guido van Rossum" <guido@python.org>
To: "Andreas Jung" <andreas@zope.com>
Cc: <jeremy@zope.com>; <jim@zope.com>; <zope-coders@zope.org>
Sent: Thursday, October 18, 2001 12:46
Subject: Re: [Zope-Coders] Re: BTrees, Unicode, and Python 2.2


> > Try to run it with 2.1 not with 2.2. As discussed yesterday
> > the error behaviour differs from 2.1 to 2.2
>
> I'm not a mindreader.  Because the subject said 2.2 I presumed it was
> a 2.2 problem.
>
> I can now reproduce what you see.  Note that it prints "<unprintable
> instance object>" in the traceback so that comes from the traceback
> module.  I hacked the traceback.py file to leave this exception alone;
> it's a KeyError with the key u'dreit\xe4gigen'.
>
> The cause is the same as I explained earlier: if you compare
> u'dreit\xe4gigen' to 'dreit\xe4gigen' the comparison raises a
> KeyError.
>
> I believe the difference between the two variations of the test may
> have to do with the fact that if the key is the same object some
> shortcut takes place that doesn't try to compare.
>
> Can you point me to the BTree code that does the comparison?
>
> --Guido van Rossum (home page: http://www.python.org/~guido/)
>
> _______________________________________________
> Zope-Coders mailing list
> Zope-Coders@zope.org
> http://lists.zope.org/mailman/listinfo/zope-coders
>