Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
ec12e829
Commit
ec12e829
authored
Feb 27, 2009
by
Georg Brandl
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
#5360: replace PyObject_HEAD_INIT by PyVarObject_HEAD_INIT.
parent
f341acd5
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
6 additions
and
6 deletions
+6
-6
Doc/extending/newtypes.rst
Doc/extending/newtypes.rst
+4
-4
Doc/extending/windows.rst
Doc/extending/windows.rst
+2
-2
No files found.
Doc/extending/newtypes.rst
View file @
ec12e829
...
...
@@ -72,7 +72,7 @@ Python floats::
Moving on, we come to the crunch --- the type object. ::
static PyTypeObject noddy_NoddyType = {
Py
Object_HEAD_INIT(NULL
)
Py
VarObject_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::
Py
Object_HEAD_INIT(NULL
)
Py
VarObject_HEAD_INIT(NULL, 0
)
This line is a bit of a wart; what we'd like to write is::
Py
Object_HEAD_INIT(&PyType_Type
)
Py
VarObject_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 = {
Py
Object_HEAD_INIT(&PyType_Type
)
Py
VarObject_HEAD_INIT(&PyType_Type, 0
)
0,
"module.instance",
...
...
Doc/extending/windows.rst
View file @
ec12e829
...
...
@@ -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::
Py
Object_HEAD_INIT(&PyType_Type
)
Py
VarObject_HEAD_INIT(&PyType_Type, 0
)
Change it to::
Py
Object_HEAD_INIT(NULL
)
Py
VarObject_HEAD_INIT(NULL, 0
)
and add the following to the module initialization function::
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment