diff options
Diffstat (limited to 'Objects/methodobject.c')
-rw-r--r-- | Objects/methodobject.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/Objects/methodobject.c b/Objects/methodobject.c index 8b67a87e79..580bb2f25b 100644 --- a/Objects/methodobject.c +++ b/Objects/methodobject.c @@ -172,7 +172,7 @@ static long meth_hash(a) PyCFunctionObject *a; { - long x; + long x,y; if (a->m_self == NULL) x = 0; else { @@ -180,7 +180,13 @@ meth_hash(a) if (x == -1) return -1; } - return x ^ (long) a->m_ml->ml_meth; + y = _Py_HashPointer(a->m_ml->ml_meth); + if (y == -1) + return -1; + x ^= y; + if (x == -1) + x = -2; + return x; } PyTypeObject PyCFunction_Type = { |