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

Andreas Jung Andreas Jung" <andreas@zope.com
Thu, 18 Oct 2001 11:19:21 -0400


lib/python/BTrees/tests/testBTreesUnicode.py in the trunk.

When accessing the unicode key is prints <unprintable object>

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 11:12
Subject: Re: [Zope-Coders] Re: BTrees, Unicode, and Python 2.2


> > The unittest fails with the following setUp() function:
> > 
> >     def setUp(self):
> >         """ setup an OOBTree with some unicode strings """
> > 
> >         self.s = unicode('dreit\xe4gigen','latin1')
> > 
> >         self.data = [('alien', 284708388),
> >                 ('fox', 284708387),
> >                 ('future', 284708388),
> >                 ('k\xf6nnten', 284708389),
> >                 ('quick', 284708387),
> >                 ('zerst\xf6rt', 284708389),
> >                 (unicode('dreit\xe4gigen','latin1'), 284708391)]
> > 
> >         self.tree = OOBTree()
> >         for k,v in self.data:   self.tree[k]=v
> > 
> > But it works with the following (last line of self.data changed):
> > 
> >     def setUp(self):
> >         """ setup an OOBTree with some unicode strings """
> > 
> >         self.s = unicode('dreit\xe4gigen','latin1')
> > 
> >         self.data = [('alien', 284708388),
> >                 ('fox', 284708387),
> >                 ('future', 284708388),
> >                 ('k\xf6nnten', 284708389),
> >                 ('quick', 284708387),
> >                 ('zerst\xf6rt', 284708389),
> >                 (self.s, 284708391)]
> > 
> >         self.tree = OOBTree()
> >         for k,v in self.data:   self.tree[k]=v
> > 
> > Any explanations for this behaviour ?
> 
> Bizarre.  The value of self.data is the same in both cases.  Please
> show the rest of the code that fails.  What kind of error do you get?
> 
> --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
>