Author: Ronan Lamy <ronan.l...@gmail.com>
Branch: 
Changeset: r87052:9a5ae30e19ff
Date: 2016-09-12 18:39 +0100
http://bitbucket.org/pypy/pypy/changeset/9a5ae30e19ff/

Log:    Using PyType_GenericNew is wrong for a metaclass (effectively
        reverts 6ea4b78fa64b)

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
@@ -4,7 +4,7 @@
 PyObject* foo3type_tp_new(PyTypeObject* metatype, PyObject* args, PyObject* 
kwds)
 {
     PyObject* newType;
-    newType = PyType_GenericNew(metatype, args, kwds);
+    newType = PyType_Type.tp_new(metatype, args, kwds);
     return newType;
 }
 
@@ -71,7 +71,6 @@
     PyObject *mod, *d;
     footype.tp_base = &PyType_Type;
     PyType_Ready(&footype);
-    Py_INCREF(&footype);
     mod = Py_InitModule("foo3", sbkMethods);
     if (mod == NULL)
         return;
@@ -80,4 +79,5 @@
         return;
     if (PyDict_SetItemString(d, "footype", (PyObject *)&footype) < 0)
         return;
+    Py_INCREF(&footype);
 }
_______________________________________________
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to