summaryrefslogtreecommitdiff
path: root/Modules
diff options
context:
space:
mode:
Diffstat (limited to 'Modules')
-rw-r--r--Modules/_functoolsmodule.c2
-rw-r--r--Modules/_threadmodule.c4
-rw-r--r--Modules/itertoolsmodule.c2
-rw-r--r--Modules/posixmodule.c3
4 files changed, 5 insertions, 6 deletions
diff --git a/Modules/_functoolsmodule.c b/Modules/_functoolsmodule.c
index ab0839cdc7..0c0fae1a97 100644
--- a/Modules/_functoolsmodule.c
+++ b/Modules/_functoolsmodule.c
@@ -573,7 +573,7 @@ keyobject_richcompare(PyObject *ko, PyObject *other, int op)
PyObject *answer;
PyObject* stack[2];
- if (Py_TYPE(other) != &keyobject_type){
+ if (!Py_IS_TYPE(other, &keyobject_type)) {
PyErr_Format(PyExc_TypeError, "other argument must be K instance");
return NULL;
}
diff --git a/Modules/_threadmodule.c b/Modules/_threadmodule.c
index da5fe7915a..11bc16f4b3 100644
--- a/Modules/_threadmodule.c
+++ b/Modules/_threadmodule.c
@@ -938,7 +938,7 @@ local_getattro(localobject *self, PyObject *name)
if (r == -1)
return NULL;
- if (Py_TYPE(self) != &localtype)
+ if (!Py_IS_TYPE(self, &localtype))
/* use generic lookup for subtypes */
return _PyObject_GenericGetAttrWithDict(
(PyObject *)self, name, ldict, 0);
@@ -1400,7 +1400,7 @@ static PyStructSequence_Desc ExceptHookArgs_desc = {
static PyObject *
thread_excepthook(PyObject *self, PyObject *args)
{
- if (Py_TYPE(args) != &ExceptHookArgsType) {
+ if (!Py_IS_TYPE(args, &ExceptHookArgsType)) {
PyErr_SetString(PyExc_TypeError,
"_thread.excepthook argument type "
"must be ExceptHookArgs");
diff --git a/Modules/itertoolsmodule.c b/Modules/itertoolsmodule.c
index d545028901..9505fd454b 100644
--- a/Modules/itertoolsmodule.c
+++ b/Modules/itertoolsmodule.c
@@ -614,7 +614,7 @@ itertools_teedataobject_impl(PyTypeObject *type, PyObject *it,
if (len == LINKCELLS) {
if (next != Py_None) {
- if (Py_TYPE(next) != &teedataobject_type)
+ if (!Py_IS_TYPE(next, &teedataobject_type))
goto err;
assert(tdo->nextlink == NULL);
Py_INCREF(next);
diff --git a/Modules/posixmodule.c b/Modules/posixmodule.c
index 4d6d255b34..29aeca4169 100644
--- a/Modules/posixmodule.c
+++ b/Modules/posixmodule.c
@@ -6380,8 +6380,7 @@ convert_sched_param(PyObject *param, struct sched_param *res)
{
long priority;
- PyObject *SchedParamType = _posixstate_global->SchedParamType;
- if (Py_TYPE(param) != (PyTypeObject *)SchedParamType) {
+ if (!Py_IS_TYPE(param, (PyTypeObject *)_posixstate_global->SchedParamType)) {
PyErr_SetString(PyExc_TypeError, "must have a sched_param object");
return 0;
}