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 ppperry
Recipients elliot.gorokhovsky, mdk, ppperry, serhiy.storchaka, tim.peters, vstinner
Date 2017-03-11.00:08:36
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1489190917.06.0.311868687218.issue28685@psf.upfronthosting.co.za>
In-reply-to
Content
Does this work with wacky code like this?
        @functools.total_ordering
	class ClassAssignmentCanBreakChecks():
		def __init__(self, i):
			self._i = i
		def __lt__ (self, other):
			last.__class__ = OrdinaryOldInteger
			return self._i < (other._i if hasattr(other, '_i') else other)
	@functools.total_ordering
	class OrdinaryOldInteger:
		def __init__(self, i):
			self._i = i
		def __lt__(self, other):
			return self._i < (other._i if hasattr(other, '_i') else other)
	lst = [ClassAssignmentCanBreakChecks(i) for i in range(10)]
	random.shuffle(lst)
	last = lst[-1]
	lst.sort()
It looks like it will initially say that all are the same type, and attempt that optimization, which will probably lead to unexpected results as that condition is no longer true after the first compare.
History
Date User Action Args
2017-03-11 00:08:37ppperrysetrecipients: + ppperry, tim.peters, vstinner, serhiy.storchaka, mdk, elliot.gorokhovsky
2017-03-11 00:08:37ppperrysetmessageid: <1489190917.06.0.311868687218.issue28685@psf.upfronthosting.co.za>
2017-03-11 00:08:37ppperrylinkissue28685 messages
2017-03-11 00:08:36ppperrycreate