return the module object from PyMODINIT_FUNC

This commit is contained in:
Benjamin Peterson 2008-12-24 16:27:25 +00:00
parent 80072cb7fa
commit 71e30a0438
5 changed files with 6 additions and 2 deletions

View File

@ -326,8 +326,8 @@ only non-\ ``static`` item defined in the module file::
return PyModule_Create(&spammodule);
}
Note that PyMODINIT_FUNC declares the function as ``void`` return type,
declares any special linkage declarations required by the platform, and for C++
Note that PyMODINIT_FUNC declares the function as ``PyObject *`` return type,
declares any special linkage declarations required by the platform, and for C++
declares the function as ``extern "C"``.
When the Python program imports module :mod:`spam` for the first time,

View File

@ -52,4 +52,5 @@ PyInit_noddy(void)
Py_INCREF(&noddy_NoddyType);
PyModule_AddObject(m, "Noddy", (PyObject *)&noddy_NoddyType);
return m;
}

View File

@ -186,4 +186,5 @@ PyInit_noddy2(void)
Py_INCREF(&NoddyType);
PyModule_AddObject(m, "Noddy", (PyObject *)&NoddyType);
return m;
}

View File

@ -239,4 +239,5 @@ PyInit_noddy3(void)
Py_INCREF(&NoddyType);
PyModule_AddObject(m, "Noddy", (PyObject *)&NoddyType);
return m;
}

View File

@ -221,4 +221,5 @@ PyInit_noddy4(void)
Py_INCREF(&NoddyType);
PyModule_AddObject(m, "Noddy", (PyObject *)&NoddyType);
return m;
}