Are range iterators thread safe?

Stefan Behnel stefan_ml at behnel.de
Thu Oct 20 08:43:49 EDT 2011


Ben Finney, 20.10.2011 13:23:
> Stefan Behnel writes:
>
>> Steven D'Aprano, 20.10.2011 10:04:
>>> Using Python 3, are range_iterator objects thread-safe?
>> The GIL ensures it's thread safe.
>
> The GIL applies only to CPython.

and PyPy.


> What is the answer for other Python
> implementations which don't have a GIL?

That would basically be Jython and IronPython.

Note that none of the three alternative implementations currently supports 
Python language version 3. So, the current answer for all existing Python 3 
implementations is: the GIL ensures that it's thread safe.

Stefan




More information about the Python-list mailing list