[pygobject] enum/flags: don't set tp_new after creatig a subtype, not supported by PyPy
- From: Christoph Reiter <creiter src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [pygobject] enum/flags: don't set tp_new after creatig a subtype, not supported by PyPy
- Date: Sat, 31 Mar 2018 21:46:24 +0000 (UTC)
commit cbb64dd73ca7114ee423caa5e5dcc58a2de87126
Author: Christoph Reiter <reiter christoph gmail com>
Date: Sat Mar 31 23:36:51 2018 +0200
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.
gi/pygenum.c | 5 +----
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;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]