[reportlab-users] Removal of global paraparser

Andy Robinson andy at reportlab.com
Mon Mar 18 08:14:43 EDT 2013


Feel free to change it to use thread locals if you want. Pdfmetrics is at least a 'known global' and not a stealth one. The global parser actually blew up for one paying client.

I have made pretty good experimental progress removing xmllib this morning! Not safe to commit yet but when done we should not need a reused parser...

Andy Robinson
ReportLab

On 18 Mar 2013, at 13:02, Robin Becker <robin at reportlab.com> wrote:


> On 17/03/2013 18:46, Andy Robinson wrote:

>> I have just committed a very small change which gets rid of the global

>> paragraph parser, and instantiates it for each Paragraph.

>>

>

> the 'correct' way to do this would be to make the parser part of a thread locals variable. That way it would be instantiated once by each thread and not by each paragraph.

>

> It's never been exactly clear why we pay a penalty for importing threading etc etc, but I assume that's why we never created these variables that way.

>

>

>> We had a real-world case of threading problems which were probably

>> down to this.

> .....

>

> I suspect that all the other threading issues will now surface eg all the module level stuff in pdfbase/pdfmetrics.py.

>

> In addition none of our accelerators has any real notion of multi-threaded politeness. Hopefully that's enforced by python itself.

> --

> Robin Becker



More information about the reportlab-users mailing list