[New-bugs-announce] [issue31443] Possibly out of date C extension documentation

Romuald Brunet report at bugs.python.org
Wed Sep 13 05:03:10 EDT 2017

New submission from Romuald Brunet:

In the "Defining New Types documentation" basics about tp_new -> PyType_GenericNew, the doc states:

> We’d like to just assign this to the tp_new slot, but we can’t, for
> portability sake, On some platforms or compilers, we can’t statically
> initialize a structure member with a function defined in another C
> module, so, instead, we’ll assign the tp_new slot in the module
> initialization function just before calling PyType_Ready():

But looking a python C code itself [1] does seem to do this. So I'm guessing that part of the documentation is now irrelevant and the example could just assign PyType_GenericNew to tp_new.

[1] https://github.com/python/cpython/blob/2ebc5ce42a8a9e047e790aefbf9a94811569b2b6/Objects/listobject.c#L2733

assignee: docs at python
components: Documentation
messages: 302038
nosy: Romuald, docs at python
priority: normal
severity: normal
status: open
title: Possibly out of date C extension documentation
type: enhancement

Python tracker <report at bugs.python.org>

More information about the New-bugs-announce mailing list