[issue8757] Automatic set-to-frozenset conversions not thread-safe

2010-08-06 Thread Daniel Stutzbach
Daniel Stutzbach added the comment: It is easy in online communications to interpret a response as a disagreement. I apologize for falling into that trap. I am +1 on removing implicit set-to-frozenset conversions, which would more effectively "fix" issue8752 for me (this is the only aspect o

[issue8757] Automatic set-to-frozenset conversions not thread-safe

2010-08-06 Thread Raymond Hettinger
Raymond Hettinger added the comment: See r83757, r83756, and r83755. The existing unittests prove the script does what it is supposed to do. The new code is just a different approach to the same problem so that it is less likely to be user visible. The attached set-race.py fragment is an in

[issue8757] Automatic set-to-frozenset conversions not thread-safe

2010-08-06 Thread Ezio Melotti
Ezio Melotti added the comment: Can the attached script be converted in a unittest that tests that the fix is correct? -- nosy: +ezio.melotti ___ Python tracker ___

[issue8757] Automatic set-to-frozenset conversions not thread-safe

2010-08-04 Thread Raymond Hettinger
Raymond Hettinger added the comment: FWIW, the current docs adequately cover the existing situation: "Note, the elem argument to the __contains__(), remove(), and discard() methods may be a set. To support searching for an equivalent frozenset, the elem set is temporarily mutated during the se

[issue8757] Automatic set-to-frozenset conversions not thread-safe

2010-08-04 Thread Raymond Hettinger
Raymond Hettinger added the comment: I didn't disagree with you. The swap bodies implementation technique is not expected and is exploitable in a number of ways. What outcome to you want? Eliminate the implicit set-to-frozenset conversion feature; introduce a non-mutating version that copie

[issue8757] Automatic set-to-frozenset conversions not thread-safe

2010-08-04 Thread Daniel Stutzbach
Daniel Stutzbach added the comment: The swap bodies technique has been used in list.sort for a long time, but users expect list.sort to mutate the list. Even with a pure-Python implementation of sets, I would not expect __contains__ to be a mutating method (unless I have gone out of way to wr

[issue8757] Automatic set-to-frozenset conversions not thread-safe

2010-08-04 Thread Raymond Hettinger
Raymond Hettinger added the comment: FWIW, I'm am considering removing this functionality in Py3.3 after the language moratorium ends. The swap-bodies technique had been included in the original sets.py and the technique is similar to the one list.sort() uses to protect against mutation dur