This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author abacabadabacaba
Recipients abacabadabacaba, rhettinger
Date 2010-04-17.19:05:36
SpamBayes Score 5.0767063e-10
Marked as misclassified No
Message-id <1271531138.23.0.461760123126.issue8420@psf.upfronthosting.co.za>
In-reply-to
Content
I've found more unsafe code in Objects/setobject.c.
This code makes Python 3.1.2 segfault by using a bug in function set_merge:

class bad:
	def __eq__(self, other):
		if be_bad:
			set2.clear()
			raise Exception
		return self is other
	def __hash__(self):
		return 0
be_bad = False
set1 = {bad()}
set2 = {bad() for i in range(2000)}
be_bad = True
set1.update(set2)

Function set_symmetric_difference_update has a similar bug.

Another bug in set_symmetric_difference_update:

class bad:
	def __init__(self):
		print("Creating", id(self))
	def __del__(self):
		print("Deleting", id(self))
	def __eq__(self, other):
		print("Comparing", id(self), "and", id(other))
		if be_bad:
			dict2.clear()
		return self is other
	def __hash__(self):
		return 0
be_bad = False
set1 = {bad()}
dict2 = {bad(): None}
be_bad = True
set1.symmetric_difference_update(dict2)
History
Date User Action Args
2010-04-17 19:05:38abacabadabacabasetrecipients: + abacabadabacaba, rhettinger
2010-04-17 19:05:38abacabadabacabasetmessageid: <1271531138.23.0.461760123126.issue8420@psf.upfronthosting.co.za>
2010-04-17 19:05:36abacabadabacabalinkissue8420 messages
2010-04-17 19:05:36abacabadabacabacreate