[pypy-commit] pypy py3k: switch to PyModule_Create

pjenvey noreply at buildbot.pypy.org
Sat Apr 13 00:41:41 CEST 2013


Author: Philip Jenvey <pjenvey at underboss.org>
Branch: py3k
Changeset: r63298:319813f454d6
Date: 2013-04-12 15:41 -0700
http://bitbucket.org/pypy/pypy/changeset/319813f454d6/

Log:	switch to PyModule_Create

diff --git a/pypy/module/cpyext/test/test_version.py b/pypy/module/cpyext/test/test_version.py
--- a/pypy/module/cpyext/test/test_version.py
+++ b/pypy/module/cpyext/test/test_version.py
@@ -6,10 +6,18 @@
     def test_versions(self):
         import sys
         init = """
+        static struct PyModuleDef moduledef = {
+                PyModuleDef_HEAD_INIT,
+                "foo",          /* m_name */
+                NULL,           /* m_doc */
+                -1,             /* m_size */
+                NULL            /* m_methods */
+            };
         if (Py_IsInitialized()) {
-            PyObject *m = Py_InitModule("foo", NULL);
+            PyObject *m = PyModule_Create(&moduledef);
             PyModule_AddStringConstant(m, "py_version", PY_VERSION);
             PyModule_AddStringConstant(m, "pypy_version", PYPY_VERSION);
+            return m;
         }
         """
         module = self.import_module(name='foo', init=init)


More information about the pypy-commit mailing list