This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: Outdated advice in C-API tutorial?
Type: resource usage Stage:
Components: Documentation Versions: Python 3.1, Python 3.2, Python 2.7
process
Status: closed Resolution: wont fix
Dependencies: Superseder:
Assigned To: docs@python Nosy List: docs@python, loewis, pitrou
Priority: normal Keywords:

Created on 2010-10-04 21:45 by pitrou, last changed 2022-04-11 14:57 by admin. This issue is now closed.

Messages (2)
msg117984 - (view) Author: Antoine Pitrou (pitrou) * (Python committer) Date: 2010-10-04 21:45
In http://docs.python.org/dev/extending/newtypes.html, you can read:

“To enable object creation, we have to provide a tp_new implementation. In this case, we can just use the default implementation provided by the API function PyType_GenericNew(). 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 the thing is, we ourselves (CPython) do exactly what is discouraged here, both in built-in types and dynamically loaded extensions.
So is this piece of advice still necessary?
msg117998 - (view) Author: Martin v. Löwis (loewis) * (Python committer) Date: 2010-10-05 08:33
The advice is still necessary, AFAIK. The issue is Windows, in particular producing function pointers across DLL boundaries. In Python core, this is not an issue, since the references will all be inside pythonXY.dll.
History
Date User Action Args
2022-04-11 14:57:07adminsetgithub: 54233
2010-10-17 06:35:48georg.brandlsetstatus: open -> closed
resolution: wont fix
2010-10-05 08:33:53loewissetmessages: + msg117998
2010-10-04 21:45:49pitroucreate