Commit 71e30a04 authored by Benjamin Peterson's avatar Benjamin Peterson

return the module object from PyMODINIT_FUNC

parent 80072cb7
...@@ -326,8 +326,8 @@ only non-\ ``static`` item defined in the module file:: ...@@ -326,8 +326,8 @@ only non-\ ``static`` item defined in the module file::
return PyModule_Create(&spammodule); return PyModule_Create(&spammodule);
} }
Note that PyMODINIT_FUNC declares the function as ``void`` return type, Note that PyMODINIT_FUNC declares the function as ``PyObject *`` return type,
declares any special linkage declarations required by the platform, and for C++ declares any special linkage declarations required by the platform, and for C++
declares the function as ``extern "C"``. declares the function as ``extern "C"``.
When the Python program imports module :mod:`spam` for the first time, When the Python program imports module :mod:`spam` for the first time,
......
...@@ -52,4 +52,5 @@ PyInit_noddy(void) ...@@ -52,4 +52,5 @@ PyInit_noddy(void)
Py_INCREF(&noddy_NoddyType); Py_INCREF(&noddy_NoddyType);
PyModule_AddObject(m, "Noddy", (PyObject *)&noddy_NoddyType); PyModule_AddObject(m, "Noddy", (PyObject *)&noddy_NoddyType);
return m;
} }
...@@ -186,4 +186,5 @@ PyInit_noddy2(void) ...@@ -186,4 +186,5 @@ PyInit_noddy2(void)
Py_INCREF(&NoddyType); Py_INCREF(&NoddyType);
PyModule_AddObject(m, "Noddy", (PyObject *)&NoddyType); PyModule_AddObject(m, "Noddy", (PyObject *)&NoddyType);
return m;
} }
...@@ -239,4 +239,5 @@ PyInit_noddy3(void) ...@@ -239,4 +239,5 @@ PyInit_noddy3(void)
Py_INCREF(&NoddyType); Py_INCREF(&NoddyType);
PyModule_AddObject(m, "Noddy", (PyObject *)&NoddyType); PyModule_AddObject(m, "Noddy", (PyObject *)&NoddyType);
return m;
} }
...@@ -221,4 +221,5 @@ PyInit_noddy4(void) ...@@ -221,4 +221,5 @@ PyInit_noddy4(void)
Py_INCREF(&NoddyType); Py_INCREF(&NoddyType);
PyModule_AddObject(m, "Noddy", (PyObject *)&NoddyType); PyModule_AddObject(m, "Noddy", (PyObject *)&NoddyType);
return m;
} }
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment