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

2010-08-06 Thread Ezio Melotti
Ezio Melotti ezio.melo...@gmail.com added the comment: Can the attached script be converted in a unittest that tests that the fix is correct? -- nosy: +ezio.melotti ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue8757

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

2010-08-06 Thread Raymond Hettinger
Raymond Hettinger rhettin...@users.sourceforge.net 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

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

2010-08-06 Thread Daniel Stutzbach
Daniel Stutzbach dan...@stutzbachenterprises.com 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

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

2010-08-04 Thread Raymond Hettinger
Raymond Hettinger rhettin...@users.sourceforge.net 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

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

2010-08-04 Thread Daniel Stutzbach
Daniel Stutzbach dan...@stutzbachenterprises.com 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

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

2010-08-04 Thread Raymond Hettinger
Raymond Hettinger rhettin...@users.sourceforge.net 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

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

2010-08-04 Thread Raymond Hettinger
Raymond Hettinger rhettin...@users.sourceforge.net 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