[Python-Dev] GIL required for _all_ Python calls?

Guido van Rossum guido at python.org
Fri Jan 8 16:48:44 CET 2010


On Fri, Jan 8, 2010 at 6:27 AM, Antoine Pitrou <solipsis at pitrou.net> wrote:
> Le Thu, 07 Jan 2010 22:11:36 +0100, Martin v. Löwis a écrit :
>>
>> Even if we do use the new API, and correctly, it still might be
>> confusing if the contents of the buffer changes underneath.
>
> Well, no more confusing than when you compute a SHA1 hash or zlib-
> compress the buffer, is it?

That depends. Algorithms that make exactly one pass over the buffer
will run fine (maybe producing a meaningless result). But the regex
matcher may scan the buffer repeatedly (for backtracking purposes) and
it would take a considerable analysis to prove that cannot mess up its
internal data structures if the data underneath changes. (I give it a
decent chance that it's fine, but since it was written without ever
considering this possibility I'm not 100% sure.)

-- 
--Guido van Rossum (python.org/~guido)



More information about the Python-Dev mailing list