[Python-3000] PyObject_HEAD_INIT

Roger Binns rogerb at rogerbinns.com
Fri Nov 14 06:23:19 CET 2008


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Something has been baffling me and is still present in py3.0 -rc2.

When initializing a (non-variable) PyTypeObject in Python 2,
PyObject_HEAD_INIT is used.  The docs for Python 3 still show that:

  http://docs.python.org/dev/3.0/extending/newtypes.html

However if you try to use it you get all sorts of severe warnings (it
looks like structure members don't line up).  Looking through the Python
3.0 source, *all* initialization is done using
PyVarObject_HEAD_INIT(NULL, 0) instead - PyObject_HEAD_INIT is not used
at all.  The Python 2.3 source shows the latter form being used almost
exclusively so at some point someone changed a lot of code.

It would seem that common practise, the examples and the documentation
don't all match each other!

Roger
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)

iEYEARECAAYFAkkdC0MACgkQmOOfHg372QRErgCdGPyIr9eLNaoivePS5AhUFzJx
KEEAnR8oYK27C5ZueWnmtk+qecOh0bpP
=LDdB
-----END PGP SIGNATURE-----



More information about the Python-3000 mailing list