summaryrefslogtreecommitdiff
path: root/Objects/methodobject.c
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2018-07-31 09:18:24 +0300
committerGitHub <noreply@github.com>2018-07-31 09:18:24 +0300
commitac20e0f98d6727ba97a9575bfa2a11b2f6247c35 (patch)
tree3b7938d610796051659b1b6fff27387a731c934c /Objects/methodobject.c
parentc48e26dcadbff8620bb5881d3bd148fc8894d0ef (diff)
downloadcpython-git-ac20e0f98d6727ba97a9575bfa2a11b2f6247c35.tar.gz
bpo-1617161: Make the hash and equality of methods not depending on the value of self. (GH-7848)
* The hash of BuiltinMethodType instances no longer depends on the hash of __self__. It depends now on the hash of id(__self__). * The hash and equality of ModuleType and MethodWrapperType instances no longer depend on the hash and equality of __self__. They depend now on the hash and equality of id(__self__). * MethodWrapperType instances no longer support ordering.
Diffstat (limited to 'Objects/methodobject.c')
-rw-r--r--Objects/methodobject.c10
1 files changed, 1 insertions, 9 deletions
diff --git a/Objects/methodobject.c b/Objects/methodobject.c
index 9606768a48..a7042ca39e 100644
--- a/Objects/methodobject.c
+++ b/Objects/methodobject.c
@@ -251,16 +251,8 @@ static Py_hash_t
meth_hash(PyCFunctionObject *a)
{
Py_hash_t x, y;
- if (a->m_self == NULL)
- x = 0;
- else {
- x = PyObject_Hash(a->m_self);
- if (x == -1)
- return -1;
- }
+ x = _Py_HashPointer(a->m_self);
y = _Py_HashPointer((void*)(a->m_ml->ml_meth));
- if (y == -1)
- return -1;
x ^= y;
if (x == -1)
x = -2;