[Python-Dev] compatibility for C-accelerated types

Serhiy Storchaka storchaka at gmail.com
Mon Oct 19 17:47:01 EDT 2015

On 20.10.15 00:00, Guido van Rossum wrote:
> Apart from Serhiy's detraction of the 3.5 bug report there wasn't any
> discussion in this thread. I also don't really see any specific
> questions, so maybe you don't have any. Are you just asking whether it's
> okay to merge your code? Or are you asking for more code review?

I think Eric ask whether it's okay to have some incompatibility between 
Python and C implementations.

1. Is it okay to have a difference in effect of __class__ assignment. 
Pure Python and extension classes have different restrictions. For 
example (tested example this time) following code works with Python 
implementation in 3.4, but fails with C implementation in 3.5:

from collections import OrderedDict
od = OrderedDict()
class D(dict): pass

od.__class__ = D

2. Is it okay to use obj.__class__ in Python implementation and 
type(obj) in C implementation for the sake of code simplification? Can 
we ignore subtle differences?

3. In general, is it okay to have some incompatibility between Python 
and C implementations for the sake of code simplification, and where the 
border line lies?

More information about the Python-Dev mailing list