diff options
author | Georg Brandl <georg@python.org> | 2009-03-31 15:52:41 (GMT) |
---|---|---|
committer | Georg Brandl <georg@python.org> | 2009-03-31 15:52:41 (GMT) |
commit | 21151760d9651767227c0676cb51915e53610f9e (patch) | |
tree | 91dfe3331849fddd5c67f965f9f9166074c70052 /Doc | |
parent | 5081f7e976d8d1c5286f705d9ec7e2ed5603db8f (diff) | |
download | cpython-21151760d9651767227c0676cb51915e53610f9e.zip cpython-21151760d9651767227c0676cb51915e53610f9e.tar.gz cpython-21151760d9651767227c0676cb51915e53610f9e.tar.bz2 |
#5548: do return the new module from PyMODINIT_FUNC functions.
Diffstat (limited to 'Doc')
-rw-r--r-- | Doc/extending/extending.rst | 7 | ||||
-rw-r--r-- | Doc/extending/newtypes.rst | 1 |
2 files changed, 5 insertions, 3 deletions
diff --git a/Doc/extending/extending.rst b/Doc/extending/extending.rst index b035d94..d7f1357 100644 --- a/Doc/extending/extending.rst +++ b/Doc/extending/extending.rst @@ -1266,12 +1266,13 @@ All that a client module must do in order to have access to the function { PyObject *m; - m = Py_InitModule("client", ClientMethods); + m = PyModule_Create(&clientmodule); if (m == NULL) - return; + return NULL; if (import_spam() < 0) - return; + return NULL; /* additional initialization can happen here */ + return m; } The main disadvantage of this approach is that the file :file:`spammodule.h` is diff --git a/Doc/extending/newtypes.rst b/Doc/extending/newtypes.rst index c20e96f..83c95f2 100644 --- a/Doc/extending/newtypes.rst +++ b/Doc/extending/newtypes.rst @@ -871,6 +871,7 @@ the module's :cfunc:`init` function. :: Py_INCREF(&ShoddyType); PyModule_AddObject(m, "Shoddy", (PyObject *) &ShoddyType); + return m; } Before calling :cfunc:`PyType_Ready`, the type structure must have the |