From d7e42f00c52c7e92638d129cb79ba62631dd64a8 Mon Sep 17 00:00:00 2001 From: "kr.angelov" Date: Fri, 5 Jul 2013 05:35:22 +0000 Subject: [PATCH] the hash function for pgf.Expr is now really added --- src/runtime/python/pypgf.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/runtime/python/pypgf.c b/src/runtime/python/pypgf.c index a327b8e77..094744885 100644 --- a/src/runtime/python/pypgf.c +++ b/src/runtime/python/pypgf.c @@ -150,6 +150,12 @@ Expr_richcompare(ExprObject *e1, ExprObject *e2, int op) } } +static long +Expr_hash(ExprObject *e) +{ + return (long) pgf_expr_hash(0, e->expr); +} + static PyMethodDef Expr_methods[] = { {"unpack", (PyCFunction)Expr_unpack, METH_VARARGS, "Decomposes an expression into its components" @@ -200,7 +206,7 @@ static PyTypeObject pgf_ExprType = { 0, /*tp_as_number*/ 0, /*tp_as_sequence*/ 0, /*tp_as_mapping*/ - 0, /*tp_hash */ + (hashfunc) Expr_hash, /*tp_hash */ 0, /*tp_call*/ (reprfunc) Expr_repr, /*tp_str*/ (getattrofunc) Expr_getattro,/*tp_getattro*/