[issue11875] OrderedDict.__reduce__ not threadsafe

2011-04-19 Thread Mario Juric
New submission from Mario Juric mju...@ias.edu: The implementation of OrderedDict.__reduce__() in Python 2.7.1 is not thread safe because of the following four lines: tmp = self.__map, self.__root del self.__map, self.__root inst_dict = vars(self).copy()

[issue11875] OrderedDict.__reduce__ not threadsafe

2011-04-19 Thread Raymond Hettinger
Changes by Raymond Hettinger raymond.hettin...@gmail.com: -- assignee: - rhettinger nosy: +rhettinger ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue11875 ___

[issue11875] OrderedDict.__reduce__ not threadsafe

2011-04-19 Thread Raymond Hettinger
Raymond Hettinger raymond.hettin...@gmail.com added the comment: To avoid hardcoding the mangled names: @@ -155,10 +155,9 @@ def __reduce__(self): 'Return state information for pickling' items = [[k, self[k]] for k in self] -tmp = self.__map, self.__root,

[issue11875] OrderedDict.__reduce__ not threadsafe

2011-04-19 Thread Roundup Robot
Roundup Robot devnull@devnull added the comment: New changeset 3150b6939731 by Raymond Hettinger in branch '2.7': Issue 11875: Keep OrderedDict's __reduce__ from temporarily mutating the object. http://hg.python.org/cpython/rev/3150b6939731 -- nosy: +python-dev

[issue11875] OrderedDict.__reduce__ not threadsafe

2011-04-19 Thread Roundup Robot
Roundup Robot devnull@devnull added the comment: New changeset 50a89739836f by Raymond Hettinger in branch '3.1': Issue 11875: Keep OrderedDict's __reduce__ from temporarily mutating the object. http://hg.python.org/cpython/rev/50a89739836f New changeset a7ac7a7c8c78 by Raymond Hettinger in

[issue11875] OrderedDict.__reduce__ not threadsafe

2011-04-19 Thread Raymond Hettinger
Raymond Hettinger raymond.hettin...@gmail.com added the comment: Mario, I removed the unnecessary mutation, but remember that OrderedDict's are not thread-safe in general. Anything that updates an OrderedDict will temporarily leave it in an inconsistent state while the links and mappings are

[issue11875] OrderedDict.__reduce__ not threadsafe

2011-04-19 Thread Mario Juric
Mario Juric mju...@ias.edu added the comment: Hi Raymond, Excellent! Many thanks for such a quick fix, this has been bugging us for months! -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue11875

[issue11875] OrderedDict.__reduce__ not threadsafe

2011-04-19 Thread Amaury Forgeot d'Arc
Amaury Forgeot d'Arc amaur...@gmail.com added the comment: The call to self.__class__() can break subclasses of OrderedDict for two reasons: - The subclass constructor may have a different signature - Attributes set by the subclass.__init__ are removed from the pickle:: import collections,

[issue11875] OrderedDict.__reduce__ not threadsafe

2011-04-19 Thread Daniel Urban
Changes by Daniel Urban urban.dani...@gmail.com: -- nosy: +durban ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue11875 ___ ___ Python-bugs-list

[issue11875] OrderedDict.__reduce__ not threadsafe

2011-04-19 Thread Roundup Robot
Roundup Robot devnull@devnull added the comment: New changeset db66eaf353a6 by Raymond Hettinger in branch '2.7': Issue #11875: Alter the previous fix to work better with subclasses http://hg.python.org/cpython/rev/db66eaf353a6 -- ___ Python tracker

[issue11875] OrderedDict.__reduce__ not threadsafe

2011-04-19 Thread Roundup Robot
Roundup Robot devnull@devnull added the comment: New changeset 408f23b6cec5 by Raymond Hettinger in branch '3.1': Issue #11875: Alter the previous fix to work better with subclasses http://hg.python.org/cpython/rev/408f23b6cec5 New changeset 4e6840477d96 by Raymond Hettinger in branch '3.2':