aboutsummaryrefslogtreecommitdiffstats
path: root/libshiboken/sbkenum.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'libshiboken/sbkenum.cpp')
-rw-r--r--libshiboken/sbkenum.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/libshiboken/sbkenum.cpp b/libshiboken/sbkenum.cpp
index 0304a1a9e..e6da02d7f 100644
--- a/libshiboken/sbkenum.cpp
+++ b/libshiboken/sbkenum.cpp
@@ -230,7 +230,10 @@ enum_richcompare(PyObject *self, PyObject *other, int op)
Py_RETURN_FALSE;
}
-
+static Py_hash_t enum_hash(PyObject* pyObj)
+{
+ return PyObject_Hash(reinterpret_cast<SbkEnumObject*>(pyObj)->ob_name);
+}
static PyGetSetDef SbkEnumGetSetList[] = {
{const_cast<char*>("name"), &SbkEnumObject_name},
@@ -507,6 +510,7 @@ PyTypeObject* newTypeWithName(const char* name, const char* cppName)
type->tp_new = SbkEnum_tp_new;
type->tp_as_number = &enum_as_number;
type->tp_richcompare = &enum_richcompare;
+ type->tp_hash = &enum_hash;
DeclaredEnumTypes::instance().addEnumType(type, cppName);
return type;