Duncan Booth duncan.booth at invalid.invalid
Wed Oct 13 18:05:11 CEST 2004

Cliff Wells wrote:

> This suddenly gave me a smack on the head that list.append is
> undoubtedly written in C and might, in fact, retain the GIL for the
> duration of the function in which case the operation might, in fact, be
> atomic (yes, I know that isn't necessarily what the above traceback was
> saying, but it served as a clue-stick).

Roughly correct. list.append is written in C and therefore you might assume 
it is atomic. However, it increases the size of a list which means it may 
allocate memory which could cause the garbage collector to kick in which in 
turn might free up cycles which could release references to objects with 
__del__ methods which could execute other byte code at which point all bets 
are off.

More information about the Python-list mailing list