Skip to content

Commit 93986a5

Browse files
committed
check types in partial_richcompare
1 parent 07c304c commit 93986a5

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

Modules/_functoolsmodule.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -484,10 +484,11 @@ partial_richcompare(PyObject *self, PyObject *other, int op)
484484
PyObject *res;
485485
int eq;
486486

487-
if (op != Py_EQ && op != Py_NE) {
487+
if ((op != Py_EQ && op != Py_NE) ||
488+
!Py_IS_TYPE(self, Py_TYPE(other)))
489+
{
488490
Py_RETURN_NOTIMPLEMENTED;
489491
}
490-
491492
a = (partialobject *) self;
492493
b = (partialobject *) other;
493494

0 commit comments

Comments
 (0)