erezsh/plyplus — pull request #8 by volpino (2013-04-18 07:41:19+00:00)
Title: Adding thread safe QA to README

We encountered some issues while using Plyplus and Django: with concurrent requests the parser broke with random errors while with sequential requests everything was working well.

We were instantiating the parser in the __init__ of a Django ClassBasedView so I tried to move the instantiation to the get() method but nothing changed (it is possible to test the issue with a simple ab -c 5 -n 5).

I found this: ```
# The current implementation is only somewhat object-oriented. The
# LR parser itself is defined in terms of an object (which allows multiple
# parsers to co-exist). However, most of the variables used during table
# construction are defined in terms of global variables. Users shouldn't
# notice unless they are trying to define multiple parsers at the same
# time using threads (in which case they should have their head examined).
```
in http://svn.openfoundry.org/pugs/v6/v6-Python/ply/yacc.py

So I tried to move the instantiation of the parsers to a global variable and it worked :) I think it's better to document this for other users.

Thanks for your work!