[Python-checkins] r70829 - in python/branches/py3k/Doc/extending: extending.rst newtypes.rst
georg.brandl
python-checkins at python.org
Tue Mar 31 17:52:41 CEST 2009
Author: georg.brandl
Date: Tue Mar 31 17:52:41 2009
New Revision: 70829
Log:
#5548: do return the new module from PyMODINIT_FUNC functions.
Modified:
python/branches/py3k/Doc/extending/extending.rst
python/branches/py3k/Doc/extending/newtypes.rst
Modified: python/branches/py3k/Doc/extending/extending.rst
==============================================================================
--- python/branches/py3k/Doc/extending/extending.rst (original)
+++ python/branches/py3k/Doc/extending/extending.rst Tue Mar 31 17:52:41 2009
@@ -1266,12 +1266,13 @@
{
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
Modified: python/branches/py3k/Doc/extending/newtypes.rst
==============================================================================
--- python/branches/py3k/Doc/extending/newtypes.rst (original)
+++ python/branches/py3k/Doc/extending/newtypes.rst Tue Mar 31 17:52:41 2009
@@ -871,6 +871,7 @@
Py_INCREF(&ShoddyType);
PyModule_AddObject(m, "Shoddy", (PyObject *) &ShoddyType);
+ return m;
}
Before calling :cfunc:`PyType_Ready`, the type structure must have the
More information about the Python-checkins
mailing list