[Python-Dev] compatibility for C-accelerated types
Serhiy Storchaka
storchaka at gmail.com
Sat Oct 17 18:38:21 EDT 2015
On 18.10.15 01:20, Eric Snow wrote:
> On the tracker he notes another OrderedDict compatibility break:
>
> Backward compatibility related to __class__ assignment was
> already broken in C implementation. In 3.4 following code
> works:
>
> >>> from collections import *
> >>> class foo(OrderedDict):
> ... def bark(self): return "spam"
> ...
> >>> class bar(OrderedDict):
> ... pass
> ...
> >>> od = bar()
> >>> od.__class__ = foo
> >>> od.bark()
> 'spam'
>
> In 3.5 it doesn't.
Sorry, I was mistaken with this example. It works in 3.5.
More information about the Python-Dev
mailing list