New submission from Eugene Kapun <abacabadabac...@gmail.com>: This code shows that frozensets aren't really immutable. The same frozenset is printed twice, with different content. Buggy functions are set_contains, set_remove and set_discard, all in Objects/setobject.c
class bad: def __eq__(self, other): global f2 f2 = other print_f2() s1.add("querty") return self is other def __hash__(self): return hash(f1) def print_f2(): print(id(f2), repr(f2)) f1 = frozenset((1, 2, 3)) s1 = set(f1) s1 in {bad()} print_f2() ---------- components: Interpreter Core messages: 103426 nosy: abacabadabacaba severity: normal status: open title: It is possible to observe a mutating frozenset type: behavior versions: Python 3.1 _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue8435> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com