Raymond Hettinger <raymond.hettin...@gmail.com> added the comment:

I think you're over-reaching.   We make almost no guarantees about atomicity.  
Having multiple implementations of Python makes that an even harder task.  

In general, critical sections need to be guarded with locks.  If an object 
claims to be thread-safe, it means that it has used locks (perhaps relying on 
the GIL) to guard its own critical sections.  

Almost any pure Python class with complex state and without locks is not 
thread-safe (for example, an insertion into an OrderedDict needs to update the 
two dicts and a doubly-linked list).

Classes written in C are necessarily thread-safe (they rely on the GIL) or else 
they would risk segfaulting.  Other implementations are free to make different 
decisions about which classes are thread-safe. Pypy tends to make fewer 
guarantees because it implements more classes in pure python.  Jython tends to 
make strong guarantees because it uses Java's concurrent mappings and other 
such tools.

For the most part, the docs have done the right thing by not making any 
promises.  It might be helpful though to have a HOWTO guide explaining the 
facts-of-life when doing multi-threading (i.e. don't assume anything is atomic 
or thread-safe unless explicitly promised and don't expect many such promises).

----------
priority: normal -> low

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue15329>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to