diff options
author | Benjamin Peterson <benjamin@python.org> | 2009-12-13 16:41:44 (GMT) |
---|---|---|
committer | Benjamin Peterson <benjamin@python.org> | 2009-12-13 16:41:44 (GMT) |
commit | d76e711eabd7b1d0ff96b4df2d8e7ba86be40abe (patch) | |
tree | 26da8ebc65742d0518f9ab1e9a033b54bd0dfd33 /Objects | |
parent | 62926f0b1e4f1b0b35eaad9a0ff5661b31a9002f (diff) | |
download | cpython-d76e711eabd7b1d0ff96b4df2d8e7ba86be40abe.zip cpython-d76e711eabd7b1d0ff96b4df2d8e7ba86be40abe.tar.gz cpython-d76e711eabd7b1d0ff96b4df2d8e7ba86be40abe.tar.bz2 |
Merged revisions 76794 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r76794 | benjamin.peterson | 2009-12-13 10:36:53 -0600 (Sun, 13 Dec 2009) | 2 lines
fix the ignoring of __cmp__ method on metaclasses #7491
........
Diffstat (limited to 'Objects')
-rw-r--r-- | Objects/typeobject.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/Objects/typeobject.c b/Objects/typeobject.c index 7e48172..a537b2b 100644 --- a/Objects/typeobject.c +++ b/Objects/typeobject.c @@ -645,7 +645,11 @@ type_richcompare(PyObject *v, PyObject *w, int op) int c; /* Make sure both arguments are types. */ - if (!PyType_Check(v) || !PyType_Check(w)) { + if (!PyType_Check(v) || !PyType_Check(w) || + /* If there is a __cmp__ method defined, let it be called instead + of our dumb function designed merely to warn. See bug + #7491. */ + Py_TYPE(v)->tp_compare || Py_TYPE(w)->tp_compare) { result = Py_NotImplemented; goto out; } |