Message302038
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 |
|
Date |
User |
Action |
Args |
2017-09-13 09:03:10 | Romuald | set | recipients:
+ Romuald, docs@python |
2017-09-13 09:03:10 | Romuald | set | messageid: <1505293390.55.0.87127393271.issue31443@psf.upfronthosting.co.za> |
2017-09-13 09:03:10 | Romuald | link | issue31443 messages |
2017-09-13 09:03:10 | Romuald | create | |
|