[Python-Dev] PEP 399: Pure Python/C Accelerator Module Compatibiilty Requirements

Raymond Hettinger raymond.hettinger at gmail.com
Mon Apr 18 19:26:17 CEST 2011


On Apr 18, 2011, at 10:11 AM, Maciej Fijalkowski wrote:
> 
> * we usually target CPython version that's already frozen, which is
> pretty inconvinient to post this changes back. Example would be a
> socket module where it has changed enough in 3.x that 2.7 changes make
> no sense.


Do you have any thoughts on the problem with the concrete C API
not working well with subclasses of builtin types?

I'm thinking that the PEP should specifically ban the practice
of using the concrete api unless it is known for sure that
an object is an exact type match.

It is okay to write PyList_New() followed by PyList_SetItem()
but not okay to use PyList_SetItem() on a user supplied
argument that is known to be a subclass of list.  A fast path
can be provided for an exact path, but there would also need
to a be a slower path that either converts the object to
an exact list or that uses PyObject_SetItem().

In the discussions about this topic, there doesn't seem to be
any technical solutions; instead, it will take a social solution
such as a PEP and clear warnings in the docs.


Raymond
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-dev/attachments/20110418/b77e70c2/attachment.html>


More information about the Python-Dev mailing list