Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Use Py_IS_TYPE to check for types
  • Loading branch information
shihai1991 committed May 3, 2020
commit 4051426f6302df48d86cfc8e8282a77d2621db19
4 changes: 2 additions & 2 deletions Objects/genericaliasobject.c
Original file line number Diff line number Diff line change
Expand Up @@ -339,8 +339,8 @@ ga_getattro(PyObject *self, PyObject *name)
static PyObject *
ga_richcompare(PyObject *a, PyObject *b, int op)
{
if (Py_TYPE(a) != &Py_GenericAliasType ||
Py_TYPE(b) != &Py_GenericAliasType ||
if (!Py_IS_TYPE(a, &Py_GenericAliasType) ||
!Py_IS_TYPE(b, &Py_GenericAliasType) ||
(op != Py_EQ && op != Py_NE))
{
Py_RETURN_NOTIMPLEMENTED;
Expand Down
2 changes: 1 addition & 1 deletion Objects/typeobject.c
Original file line number Diff line number Diff line change
Expand Up @@ -6306,7 +6306,7 @@ FUNCNAME(PyObject *self, PyObject *other) \
stack[1] = other; \
r = vectorcall_maybe(tstate, &op_id, stack, 2); \
if (r != Py_NotImplemented || \
Py_TYPE(other) == Py_TYPE(self)) \
Py_IS_TYPE(other, Py_TYPE(self))) \
return r; \
Py_DECREF(r); \
} \
Expand Down