Skip to content

Commit

Permalink
bpo-39573: Use Py_IS_TYPE to check for types (GH-19882)
Browse files Browse the repository at this point in the history
  • Loading branch information
shihai1991 authored May 4, 2020
1 parent 846d8b2 commit 5e8ffe1
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions Objects/genericaliasobject.c
Original file line number Diff line number Diff line change
Expand Up @@ -424,8 +424,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

0 comments on commit 5e8ffe1

Please sign in to comment.