File tree 6 files changed +11
-10
lines changed
Misc/NEWS.d/next/Documentation
6 files changed +11
-10
lines changed Original file line number Diff line number Diff line change @@ -88,7 +88,7 @@ standard Python floats::
88
88
The second bit is the definition of the type object. ::
89
89
90
90
static PyTypeObject CustomType = {
91
- PyVarObject_HEAD_INIT(NULL, 0)
91
+ .ob_base = PyVarObject_HEAD_INIT(NULL, 0)
92
92
.tp_name = "custom.Custom",
93
93
.tp_doc = PyDoc_STR("Custom objects"),
94
94
.tp_basicsize = sizeof(CustomObject),
@@ -109,7 +109,7 @@ common practice to not specify them explicitly unless you need them.
109
109
110
110
We're going to pick it apart, one field at a time::
111
111
112
- PyVarObject_HEAD_INIT(NULL, 0)
112
+ .ob_base = PyVarObject_HEAD_INIT(NULL, 0)
113
113
114
114
This line is mandatory boilerplate to initialize the ``ob_base ``
115
115
field mentioned above. ::
Original file line number Diff line number Diff line change @@ -7,7 +7,7 @@ typedef struct {
7
7
} CustomObject ;
8
8
9
9
static PyTypeObject CustomType = {
10
- PyVarObject_HEAD_INIT (NULL , 0 )
10
+ . ob_base = PyVarObject_HEAD_INIT (NULL , 0 )
11
11
.tp_name = "custom.Custom" ,
12
12
.tp_doc = PyDoc_STR ("Custom objects" ),
13
13
.tp_basicsize = sizeof (CustomObject ),
@@ -17,7 +17,7 @@ static PyTypeObject CustomType = {
17
17
};
18
18
19
19
static PyModuleDef custommodule = {
20
- PyModuleDef_HEAD_INIT ,
20
+ . m_base = PyModuleDef_HEAD_INIT ,
21
21
.m_name = "custom" ,
22
22
.m_doc = "Example module that creates an extension type." ,
23
23
.m_size = -1 ,
Original file line number Diff line number Diff line change @@ -90,7 +90,7 @@ static PyMethodDef Custom_methods[] = {
90
90
};
91
91
92
92
static PyTypeObject CustomType = {
93
- PyVarObject_HEAD_INIT (NULL , 0 )
93
+ . ob_base = PyVarObject_HEAD_INIT (NULL , 0 )
94
94
.tp_name = "custom2.Custom" ,
95
95
.tp_doc = PyDoc_STR ("Custom objects" ),
96
96
.tp_basicsize = sizeof (CustomObject ),
@@ -104,7 +104,7 @@ static PyTypeObject CustomType = {
104
104
};
105
105
106
106
static PyModuleDef custommodule = {
107
- PyModuleDef_HEAD_INIT ,
107
+ . m_base = PyModuleDef_HEAD_INIT ,
108
108
.m_name = "custom2" ,
109
109
.m_doc = "Example module that creates an extension type." ,
110
110
.m_size = -1 ,
Original file line number Diff line number Diff line change @@ -130,7 +130,7 @@ static PyMethodDef Custom_methods[] = {
130
130
};
131
131
132
132
static PyTypeObject CustomType = {
133
- PyVarObject_HEAD_INIT (NULL , 0 )
133
+ . ob_base = PyVarObject_HEAD_INIT (NULL , 0 )
134
134
.tp_name = "custom3.Custom" ,
135
135
.tp_doc = PyDoc_STR ("Custom objects" ),
136
136
.tp_basicsize = sizeof (CustomObject ),
@@ -145,7 +145,7 @@ static PyTypeObject CustomType = {
145
145
};
146
146
147
147
static PyModuleDef custommodule = {
148
- PyModuleDef_HEAD_INIT ,
148
+ . m_base = PyModuleDef_HEAD_INIT ,
149
149
.m_name = "custom3" ,
150
150
.m_doc = "Example module that creates an extension type." ,
151
151
.m_size = -1 ,
Original file line number Diff line number Diff line change @@ -146,7 +146,7 @@ static PyMethodDef Custom_methods[] = {
146
146
};
147
147
148
148
static PyTypeObject CustomType = {
149
- PyVarObject_HEAD_INIT (NULL , 0 )
149
+ . ob_base = PyVarObject_HEAD_INIT (NULL , 0 )
150
150
.tp_name = "custom4.Custom" ,
151
151
.tp_doc = PyDoc_STR ("Custom objects" ),
152
152
.tp_basicsize = sizeof (CustomObject ),
@@ -163,7 +163,7 @@ static PyTypeObject CustomType = {
163
163
};
164
164
165
165
static PyModuleDef custommodule = {
166
- PyModuleDef_HEAD_INIT ,
166
+ . m_base = PyModuleDef_HEAD_INIT ,
167
167
.m_name = "custom4" ,
168
168
.m_doc = "Example module that creates an extension type." ,
169
169
.m_size = -1 ,
Original file line number Diff line number Diff line change
1
+ Fix extension type from documentation for compiling in C++20 mode
You can’t perform that action at this time.
0 commit comments