Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 71e30a0

Browse files
committed
return the module object from PyMODINIT_FUNC
1 parent 80072cb commit 71e30a0

5 files changed

Lines changed: 6 additions & 2 deletions

File tree

Doc/extending/extending.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -326,8 +326,8 @@ only non-\ ``static`` item defined in the module file::
326326
return PyModule_Create(&spammodule);
327327
}
328328

329-
Note that PyMODINIT_FUNC declares the function as ``void`` return type,
330-
declares any special linkage declarations required by the platform, and for C++
329+
Note that PyMODINIT_FUNC declares the function as ``PyObject *`` return type,
330+
declares any special linkage declarations required by the platform, and for C++
331331
declares the function as ``extern "C"``.
332332

333333
When the Python program imports module :mod:`spam` for the first time,

Doc/includes/noddy.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,4 +52,5 @@ PyInit_noddy(void)
5252

5353
Py_INCREF(&noddy_NoddyType);
5454
PyModule_AddObject(m, "Noddy", (PyObject *)&noddy_NoddyType);
55+
return m;
5556
}

Doc/includes/noddy2.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -186,4 +186,5 @@ PyInit_noddy2(void)
186186

187187
Py_INCREF(&NoddyType);
188188
PyModule_AddObject(m, "Noddy", (PyObject *)&NoddyType);
189+
return m;
189190
}

Doc/includes/noddy3.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -239,4 +239,5 @@ PyInit_noddy3(void)
239239

240240
Py_INCREF(&NoddyType);
241241
PyModule_AddObject(m, "Noddy", (PyObject *)&NoddyType);
242+
return m;
242243
}

Doc/includes/noddy4.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -221,4 +221,5 @@ PyInit_noddy4(void)
221221

222222
Py_INCREF(&NoddyType);
223223
PyModule_AddObject(m, "Noddy", (PyObject *)&NoddyType);
224+
return m;
224225
}

0 commit comments

Comments
 (0)