[issue4592] Example patch is missing something

Amaury Forgeot d'Arc report at bugs.python.org
Mon Dec 8 17:50:00 CET 2008


Amaury Forgeot d'Arc <amauryfa at gmail.com> added the comment:

In python2.6, Py_InitModule4() calls PyImport_AddModule().
Why doesn't python3.0's PyModule_Create() do the same?

Index: Objects/moduleobject.c
===================================================================
--- Objects/moduleobject.c      (revision 67577)
+++ Objects/moduleobject.c      (working copy)
@@ -103,8 +103,9 @@
                        _Py_PackageContext = NULL;
                }
        }
-       if ((m = (PyModuleObject*)PyModule_New(name)) == NULL)
+       if ((m = (PyModuleObject*)PyImport_AddModule(name)) == NULL)
                return NULL;
+       Py_INCREF(m);

        if (module->m_size > 0) {
                m->md_state = PyMem_MALLOC(module->m_size);

----------
nosy: +amaury.forgeotdarc, loewis

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue4592>
_______________________________________


More information about the Python-bugs-list mailing list