mirror of
https://github.com/python/cpython.git
synced 2024-11-24 18:34:43 +08:00
#5548: do return the new module from PyMODINIT_FUNC functions.
This commit is contained in:
parent
5081f7e976
commit
21151760d9
@ -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
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user