summaryrefslogtreecommitdiffstats
path: root/Objects
diff options
context:
space:
mode:
authorHai Shi <shihai1992@gmail.com>2020-05-04 13:31:38 (GMT)
committerGitHub <noreply@github.com>2020-05-04 13:31:38 (GMT)
commit5e8ffe147710e449c2e935a4e2ff5cbd19828a8a (patch)
tree4faa5ee8ccbae4dc255e0a2d912b6e64602b0538 /Objects
parent846d8b28ab9bb6197ee81372820311c0abe509c0 (diff)
downloadcpython-5e8ffe147710e449c2e935a4e2ff5cbd19828a8a.zip
cpython-5e8ffe147710e449c2e935a4e2ff5cbd19828a8a.tar.gz
cpython-5e8ffe147710e449c2e935a4e2ff5cbd19828a8a.tar.bz2
bpo-39573: Use Py_IS_TYPE to check for types (GH-19882)
Diffstat (limited to 'Objects')
-rw-r--r--Objects/genericaliasobject.c4
-rw-r--r--Objects/typeobject.c2
2 files changed, 3 insertions, 3 deletions
diff --git a/Objects/genericaliasobject.c b/Objects/genericaliasobject.c
index c06d79c..4d511a2 100644
--- a/Objects/genericaliasobject.c
+++ b/Objects/genericaliasobject.c
@@ -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;
diff --git a/Objects/typeobject.c b/Objects/typeobject.c
index c2ddc16..db0ae97 100644
--- a/Objects/typeobject.c
+++ b/Objects/typeobject.c
@@ -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); \
} \