diff options
author | Christoph Reiter <reiter.christoph@gmail.com> | 2018-03-31 23:36:51 +0200 |
---|---|---|
committer | Christoph Reiter <reiter.christoph@gmail.com> | 2018-03-31 23:36:51 +0200 |
commit | cbb64dd73ca7114ee423caa5e5dcc58a2de87126 (patch) | |
tree | 5b0940794a465547ed8714d424b1e3ebc454d32e | |
parent | 743f530e2a1258d3a940eae51eaf0e7fa2289dce (diff) | |
download | pygobject-cbb64dd73ca7114ee423caa5e5dcc58a2de87126.tar.gz |
enum/flags: don't set tp_new after creatig a subtype, not supported by PyPy
We always set it to the same thing anyway, so no need to change it.
This makes the test suite not crash under PyPy3.
-rw-r--r-- | gi/pygenum.c | 5 | ||||
-rw-r--r-- | gi/pygflags.c | 5 |
2 files changed, 2 insertions, 8 deletions
diff --git a/gi/pygenum.c b/gi/pygenum.c index e315669e..5671ff5d 100644 --- a/gi/pygenum.c +++ b/gi/pygenum.c @@ -257,7 +257,6 @@ pyg_enum_add (PyObject * module, } ((PyTypeObject *)stub)->tp_flags &= ~Py_TPFLAGS_BASETYPE; - ((PyTypeObject *)stub)->tp_new = pyg_enum_new; if (module) PyDict_SetItemString(((PyTypeObject *)stub)->tp_dict, @@ -376,10 +375,8 @@ pygi_enum_register_types(PyObject *d) pygenum_class_key = g_quark_from_static_string("PyGEnum::class"); PyGEnum_Type.tp_base = &PYGLIB_PyLong_Type; -#if PY_VERSION_HEX < 0x03000000 PyGEnum_Type.tp_new = pyg_enum_new; -#else - PyGEnum_Type.tp_new = PyLong_Type.tp_new; +#if PY_VERSION_HEX >= 0x03000000 PyGEnum_Type.tp_hash = PyLong_Type.tp_hash; #endif PyGEnum_Type.tp_repr = (reprfunc)pyg_enum_repr; diff --git a/gi/pygflags.c b/gi/pygflags.c index 049c4bf7..3280a8c6 100644 --- a/gi/pygflags.c +++ b/gi/pygflags.c @@ -279,7 +279,6 @@ pyg_flags_add (PyObject * module, } ((PyTypeObject *)stub)->tp_flags &= ~Py_TPFLAGS_BASETYPE; - ((PyTypeObject *)stub)->tp_new = pyg_flags_new; if (module) { PyDict_SetItemString(((PyTypeObject *)stub)->tp_dict, @@ -505,10 +504,8 @@ pygi_flags_register_types(PyObject *d) pygflags_class_key = g_quark_from_static_string("PyGFlags::class"); PyGFlags_Type.tp_base = &PYGLIB_PyLong_Type; -#if PY_VERSION_HEX < 0x03000000 PyGFlags_Type.tp_new = pyg_flags_new; -#else - PyGFlags_Type.tp_new = PyLong_Type.tp_new; +#if PY_VERSION_HEX >= 0x03000000 PyGFlags_Type.tp_hash = PyLong_Type.tp_hash; #endif PyGFlags_Type.tp_repr = (reprfunc)pyg_flags_repr; |