[issue12680] cPickle.loads is not thread safe due to non-thread-safe imports

2011-08-02 Thread Sagiv Malihi
New submission from Sagiv Malihi : When trying to cPickle.loads() from several threads at once, there is a race condition when threads try to import modules. An example will explain it best: suppose I have module foo.py which takes some time to load: import time class A(object): def

[issue12680] cPickle.loads is not thread safe due to non-thread-safe imports

2011-08-02 Thread Sagiv Malihi
Sagiv Malihi added the comment: OK, digging deeper reveals that there are actually two bugs here, one is conceptual in the python importing mechanism, and the other is technical in cPickle. The first bug: PyImport_ExecCodeModuleEx adds the module to sys.modules *before* actually executing

[issue12680] cPickle.loads is not thread safe due to non-thread-safe imports

2011-08-09 Thread Sagiv Malihi
Sagiv Malihi added the comment: As I said - it certainly happenes on 3.2 (tested). @pitrou - what you suggested will not work since the actual import will block on the import lock. The optimization there is not needed, it's already implemented in __imp

[issue8733] list type and UserList do not call super in __init__ and therefore, they cannot be parents in a multiple inheritence scheme

2010-05-17 Thread Sagiv Malihi
Changes by Sagiv Malihi : -- nosy: +Sagiv.Malihi ___ Python tracker <http://bugs.python.org/issue8733> ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue8733] list type and UserList do not call super in __init__ and therefore, they cannot be parents in a multiple inheritence scheme

2010-05-19 Thread Sagiv Malihi
Sagiv Malihi added the comment: Example: class A(object): def __init__(self): print "initializing something very important" # and then pay it forward... super(A, self).__init__() class B(list, A): pass b = B() # A's init