[Python-checkins] r70028 - in python/branches/py3k/Doc/extending: newtypes.rst windows.rst
georg.brandl
python-checkins at python.org
Fri Feb 27 18:11:24 CET 2009
Author: georg.brandl
Date: Fri Feb 27 18:11:23 2009
New Revision: 70028
Log:
#5360: replace PyObject_HEAD_INIT by PyVarObject_HEAD_INIT.
Modified:
python/branches/py3k/Doc/extending/newtypes.rst
python/branches/py3k/Doc/extending/windows.rst
Modified: python/branches/py3k/Doc/extending/newtypes.rst
==============================================================================
--- python/branches/py3k/Doc/extending/newtypes.rst (original)
+++ python/branches/py3k/Doc/extending/newtypes.rst Fri Feb 27 18:11:23 2009
@@ -72,7 +72,7 @@
Moving on, we come to the crunch --- the type object. ::
static PyTypeObject noddy_NoddyType = {
- PyObject_HEAD_INIT(NULL)
+ PyVarObject_HEAD_INIT(NULL, 0)
"noddy.Noddy", /* tp_name */
sizeof(noddy_NoddyObject), /* tp_basicsize */
0, /* tp_itemsize */
@@ -103,11 +103,11 @@
This is so important that we're going to pick the top of it apart still
further::
- PyObject_HEAD_INIT(NULL)
+ PyVarObject_HEAD_INIT(NULL, 0)
This line is a bit of a wart; what we'd like to write is::
- PyObject_HEAD_INIT(&PyType_Type)
+ PyVarObject_HEAD_INIT(&PyType_Type, 0)
as the type of a type object is "type", but this isn't strictly conforming C and
some compilers complain. Fortunately, this member will be filled in for us by
@@ -1427,7 +1427,7 @@
The statically-declared type object for instances is defined this way::
PyTypeObject PyInstance_Type = {
- PyObject_HEAD_INIT(&PyType_Type)
+ PyVarObject_HEAD_INIT(&PyType_Type, 0)
0,
"module.instance",
Modified: python/branches/py3k/Doc/extending/windows.rst
==============================================================================
--- python/branches/py3k/Doc/extending/windows.rst (original)
+++ python/branches/py3k/Doc/extending/windows.rst Fri Feb 27 18:11:23 2009
@@ -169,11 +169,11 @@
If your module creates a new type, you may have trouble with this line::
- PyObject_HEAD_INIT(&PyType_Type)
+ PyVarObject_HEAD_INIT(&PyType_Type, 0)
Change it to::
- PyObject_HEAD_INIT(NULL)
+ PyVarObject_HEAD_INIT(NULL, 0)
and add the following to the module initialization function::
More information about the Python-checkins
mailing list