Felipe Almeida Lessa wrote: > Em Sáb, 2006-03-11 às 12:49 +0100, robert escreveu: > >>Meanwhile I think this is a bug of cPickle.dump: It should use .keys() >>instead of free iteration internally, when pickling elementary dicts. >>I'd file a bug if no objection. > > > AFAICS, it's a problem with your code. You should lock your object while > using it. That's what Threading.Lock is supposed to work for. If you > want to use threads, you have to know in what parts of your code there > should be locks.
99.99% no. I would have to use a lock everywhere, where I add or remove something into a dict or list of the struct. Thats not the purpose of big thread locks. Such simple operations are already atomic by the definition of Python - and thanks to the global interpreter lock. (Otherwise I would leave the Python language, God beware ... :-) ) I'm of course aware, where to use locks for resons of the application. But this is an issue on Python level. And it can be solved gracly and simple in Python - I guess: If cPickle.dump (and maybe also copy/deepcopy?) is corrected to work atomic on dicts (use .keys()) and list-copies or locks python threads) the problem is solved gracely and generally. Robert -- http://mail.python.org/mailman/listinfo/python-list