[Python-Dev] Re: Thread safety of deques (original) (raw)

Aahz aahz at pythoncraft.com
Tue Jul 20 05:55:54 CEST 2004


On Mon, Jul 19, 2004, Phillip J. Eby wrote:

However, anything that calls back into Python code isn't necessarily atomic, and in general, almost anything can call back into Python code.

Yup.

For example, the seemingly harmless dictionary item assignment can call back into Python for a custom type's hash and eq methods, so could it be that a thread switch could actually occur during this statement:

foo[bar] = baz if 'bar' has such custom methods? Maybe I'm wrong, and the GIL is still held in such a case, but I'm not sure how.

No, it isn't.

Aahz (aahz at pythoncraft.com) <*> http://www.pythoncraft.com/

Barbara Boxer speaks for me: http://buffaloreport.com/2004/040713.boxer.marriage.html



More information about the Python-Dev mailing list