From 71e30a0438dcb8089b57d3c0d11c84c3e62e54d1 Mon Sep 17 00:00:00 2001 From: Benjamin Peterson Date: Wed, 24 Dec 2008 16:27:25 +0000 Subject: return the module object from PyMODINIT_FUNC --- Doc/extending/extending.rst | 4 ++-- Doc/includes/noddy.c | 1 + Doc/includes/noddy2.c | 1 + Doc/includes/noddy3.c | 1 + Doc/includes/noddy4.c | 1 + 5 files changed, 6 insertions(+), 2 deletions(-) diff --git a/Doc/extending/extending.rst b/Doc/extending/extending.rst index ef2c726..17a8110 100644 --- a/Doc/extending/extending.rst +++ b/Doc/extending/extending.rst @@ -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, diff --git a/Doc/includes/noddy.c b/Doc/includes/noddy.c index 26a49a9..b6b7d6f 100644 --- a/Doc/includes/noddy.c +++ b/Doc/includes/noddy.c @@ -52,4 +52,5 @@ PyInit_noddy(void) Py_INCREF(&noddy_NoddyType); PyModule_AddObject(m, "Noddy", (PyObject *)&noddy_NoddyType); + return m; } diff --git a/Doc/includes/noddy2.c b/Doc/includes/noddy2.c index 5daecf9..db9c7a8 100644 --- a/Doc/includes/noddy2.c +++ b/Doc/includes/noddy2.c @@ -186,4 +186,5 @@ PyInit_noddy2(void) Py_INCREF(&NoddyType); PyModule_AddObject(m, "Noddy", (PyObject *)&NoddyType); + return m; } diff --git a/Doc/includes/noddy3.c b/Doc/includes/noddy3.c index 39cdfdb..e98b87f 100644 --- a/Doc/includes/noddy3.c +++ b/Doc/includes/noddy3.c @@ -239,4 +239,5 @@ PyInit_noddy3(void) Py_INCREF(&NoddyType); PyModule_AddObject(m, "Noddy", (PyObject *)&NoddyType); + return m; } diff --git a/Doc/includes/noddy4.c b/Doc/includes/noddy4.c index 94507ec..5be00a7 100644 --- a/Doc/includes/noddy4.c +++ b/Doc/includes/noddy4.c @@ -221,4 +221,5 @@ PyInit_noddy4(void) Py_INCREF(&NoddyType); PyModule_AddObject(m, "Noddy", (PyObject *)&NoddyType); + return m; } -- cgit v0.12