Author: mattip <[email protected]>
Branch: cpyext-ext
Changeset: r82674:c95852e53e64
Date: 2016-03-02 18:28 -0500
http://bitbucket.org/pypy/pypy/changeset/c95852e53e64/

Log:    fix uppercase/lowercase issues till test passes -A, exceeds
        recursion depth untranslated

diff --git a/pypy/module/cpyext/test/foo3.c b/pypy/module/cpyext/test/foo3.c
--- a/pypy/module/cpyext/test/foo3.c
+++ b/pypy/module/cpyext/test/foo3.c
@@ -9,9 +9,9 @@
     return newType;
 }
 
-PyTypeObject Foo3Type_Type = {
-    PyVarObject_HEAD_INIT(0, 0)
-    /*tp_name*/             "Foo3.Type",
+PyTypeObject footype = {
+    PyVarObject_HEAD_INIT(NULL, 0)
+    /*tp_name*/             "foo3.footype",
     /*tp_basicsize*/        sizeof(PyTypeObject),
     /*tp_itemsize*/         0,
     /*tp_dealloc*/          0,
@@ -40,7 +40,7 @@
     /*tp_methods*/          0,
     /*tp_members*/          0,
     /*tp_getset*/           0,
-    /*tp_base*/             0,         //  set to &PyType_Type in module init 
function (why can it not be done here?)
+    /*tp_base*/             0,  //  set to &PyType_Type in module init 
function (why can it not be done here?)
     /*tp_dict*/             0,
     /*tp_descr_get*/        0,
     /*tp_descr_set*/        0,
@@ -69,8 +69,15 @@
 PyMODINIT_FUNC
 initfoo3(void)
 {
-       PyObject* mod = Py_InitModule("Foo3", sbkMethods);
-       Foo3Type_Type.tp_base = &PyType_Type;
-       PyType_Ready(&Foo3Type_Type);
-       PyModule_AddObject(mod, "Type", (PyObject*)&Foo3Type_Type);
+    PyObject *mod, *d;
+    footype.tp_base = &PyType_Type;
+    PyType_Ready(&footype);
+    mod = Py_InitModule("foo3", sbkMethods);
+    if (mod == NULL)
+        return;
+    d = PyModule_GetDict(mod);
+    if (d == NULL)
+        return;
+    if (PyDict_SetItemString(d, "footype", (PyObject *)&footype) < 0)
+        return;
 }
diff --git a/pypy/module/cpyext/test/test_typeobject.py 
b/pypy/module/cpyext/test/test_typeobject.py
--- a/pypy/module/cpyext/test/test_typeobject.py
+++ b/pypy/module/cpyext/test/test_typeobject.py
@@ -866,8 +866,8 @@
 
     def test_tp_new_in_subclass_of_type(self):
         module = self.import_module(name='foo3')
-        print('calling module.Type()...')
-        module.Type("X", (object,), {})
+        print('calling module.footype()...')
+        module.footype("X", (object,), {})
 
     def test_app_subclass_of_c_type(self):
         module = self.import_module(name='foo')
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to