[Cython] CEP 1001 - Custom PyTypeObject extensions
njs at pobox.com
Sat May 12 20:44:16 CEST 2012
On Fri, May 11, 2012 at 2:25 PM, Dag Sverre Seljebotn
<d.s.seljebotn at astro.uio.no> wrote:
> This comes from a refactor of the work on CEP 1000: A PEP proposal, with a
> hack for use in current Python versions and in the case of PEP rejection,
> that allows 3rd party libraries to agree on extensions to PyTypeObject.
> If this makes it as a PEP, I don't think we need to think about having CEP
> 1000 accepted as a PEP.
There should probably be some discussion of memory management for the
tpe_data pointers. (I assume it's "guaranteed to be valid for as long
as the associated PyTypeObject, and the PyTypeObject is responsible
for making sure any necessary cleanup happens if it gets deallocated",
but a note to this effect would be good.)
What happens if I want to inherit from PyTypeObject (a "metaclass")
and also implement this interface? It is possible? What if I want to
inherit from an existing subclass of PyTypeObject and add on this
interface? I don't know enough gnarly details about how new style
classes are implemented to tell. Would it make sense to make this
memory-layout-equivalent to a PyTypeObject subclass with extra fields?
More information about the cython-devel