returning a value from a thread

Jeff Epler jepler at
Mon Jul 19 17:59:57 CEST 2004

On Mon, Jul 19, 2004 at 01:48:01PM +0000, Antoon Pardon wrote:
> I still have a question. Is the GIL necessary even if there is
> no sharing of data between threads?

Data is always shared between threads.  One object you're almost certainly
sharing between threads is "None".  In the CPython implementation, None
has a refcount just like any other object, and that refcount is modified
in any statement involving None, and by the implicit "return None" at
the end of a function.

The GIL has the effect (among other things) of ensuring that changes to
refcounts are serialized among threads.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 196 bytes
Desc: not available
URL: <>

More information about the Python-list mailing list