[New-bugs-announce] [issue8435] It is possible to observe a mutating frozenset

Eugene Kapun report at bugs.python.org
Sat Apr 17 21:26:19 CEST 2010

New submission from Eugene Kapun <abacabadabacaba at 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
		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()}

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 <report at bugs.python.org>

More information about the New-bugs-announce mailing list