[reportlab-users] Puzzling Error

Robin Becker reportlab-users@reportlab.com
Wed, 6 Nov 2002 11:37:55 +0000


In article <20021106110654.GB12409@mail.librelogiciel.com>, Jerome Alet
<alet@librelogiciel.com> writes
.......
>
>whenever an attribute access is done in pycanvas's classes instances,
>the attribute is faked by creating a new instance of one of
>pycanvas classes.
>
>however two subsequent accesses to the same attribute produce two 
>different instances to represent the very same value, and so the 
>hash value created to access to the font dictionnary in 
>pdfmetrics.py is different each time, so the font is never found. 
>
>the str() call solved this.
>
>it seems that 2.2 is intelligent enough to either return the previous
>instance, or more probably put the new one at the same physical location
>than the old one (who was probably automatically deleted when unused).
>
>anyone could confirm ?
......
I guess it's just luck. I seem to remember from somewhere that string
constants that look like identifiers get interned, but if the string is
being assembled some how that won't always be done.

I know that when we upgraded to 2.2 the magic tt2ps ps2tt functions
(which are based on dictionaries) suddenly went wrong.

I guess we need a better map for string keys :( 
-- 
Robin Becker