[Python-Dev] SRE should release the GIL (was: no subject)

Eric Noyau eric.noyau at gmail.com
Fri Nov 25 15:21:19 CET 2005


Hi all,

I've implemented a patch,  please visit bug 1366311 for details.

https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1366311&group_id=5470

This patch only release the GIL when the engine perform a low level search
*and* if the object searched is a string or a unicode string. The GIL will
not be released for any other kind of objects, as there is no guarantee of
immutability of the buffer during the run.

I've tested this with a couple of simple tests, and also by running the
application Duncan talked about. My testing indicates that everything works
as before with the added value that our application is still responsive even
when processing some of the more egregious regular expressions.

As it is my first foray into python module writing I'll welcome any feedback
you may have on the patch.

Regards,
-- Eric


On 11/25/05, Fredrik Lundh <fredrik at pythonware.com> wrote:
>
> Martin v. Löwis wrote:
>
> > Formally: no; it access a Python string/Python unicode object all
> > the time.
> >
> > Now, since all the shared objects it accesses are immutable, likely
> > no harm would be done releasing the GIL. I think SRE was originally
> > also intended to operate on array.array objects; this would have
> > caused bigger problems.
>
> SRE can operate on anything that implements the buffer interface.
>
> </F>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.python.org/pipermail/python-dev/attachments/20051125/308a9692/attachment.html


More information about the Python-Dev mailing list