diff options
author | Georg Brandl <georg@python.org> | 2009-02-27 17:11:23 (GMT) |
---|---|---|
committer | Georg Brandl <georg@python.org> | 2009-02-27 17:11:23 (GMT) |
commit | ec12e8295242e2513fee1db3935036f6bbc6df34 (patch) | |
tree | 201475da4beaa2969ff0cb572408026ddb8feecc /Doc/extending | |
parent | f341acd5b539facaae2b833842518eff5cc28fbd (diff) | |
download | cpython-ec12e8295242e2513fee1db3935036f6bbc6df34.zip cpython-ec12e8295242e2513fee1db3935036f6bbc6df34.tar.gz cpython-ec12e8295242e2513fee1db3935036f6bbc6df34.tar.bz2 |
#5360: replace PyObject_HEAD_INIT by PyVarObject_HEAD_INIT.
Diffstat (limited to 'Doc/extending')
-rw-r--r-- | Doc/extending/newtypes.rst | 8 | ||||
-rw-r--r-- | Doc/extending/windows.rst | 4 |
2 files changed, 6 insertions, 6 deletions
diff --git a/Doc/extending/newtypes.rst b/Doc/extending/newtypes.rst index 5264a87..c20e96f 100644 --- a/Doc/extending/newtypes.rst +++ b/Doc/extending/newtypes.rst @@ -72,7 +72,7 @@ Python floats:: 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 @@ it's common practice to not specify them explicitly unless you need them. 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 @@ type is defined with the following structure:: 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", diff --git a/Doc/extending/windows.rst b/Doc/extending/windows.rst index 29e9e1e..8d1986f 100644 --- a/Doc/extending/windows.rst +++ b/Doc/extending/windows.rst @@ -169,11 +169,11 @@ described here are distributed with the Python sources in the 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:: |