◐ Shell
clean mode source ↗

Message 28574 - Python tracker

The attached scripts causes infinite recursion on the C level resulting in a 
crash.

The script defines a subclass of object that throws an exception in its 
__reduce__ method.

This method is then uses as the value of a slot on a subclass of float. This 
subclass also defines a __class__ property that returns the __class__ of the 
value in its sole slot.

Finally an instance of the subclass of float is pickled. This results in 
infinite recursion. The problem goes away when __reduce__ doesn't raise 
an exception or when the __class__ property is removed.