[reportlab-users] Puzzling Error

Jerome Alet reportlab-users@reportlab.com
Wed, 6 Nov 2002 14:51:06 +0100

On Wed, Nov 06, 2002 at 11:37:55AM +0000, Robin Becker wrote:
> In article <20021106110654.GB12409@mail.librelogiciel.com>, Jerome Alet
> <alet@librelogiciel.com> writes
> >
> >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).
> ......
> 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.

It seems I've got a working version with 1.5.2 which requires no
modification to pdfmetrics.py (I've deleted the str() calls and the
string.lower() call), so we're back to the pre-pycanvas version

Instead of redefining __str__ I've redefined __hash__ in pycanvas.py 
so all is automatic and transparent

the test suite seems to pass with 1.5.2.

Can I send you the pdfmetrics.py and pycanvas.py code privately 
in order for you to double check this ?

thanks in advance

Jerome Alet