summaryrefslogtreecommitdiffstats
path: root/Modules/_threadmodule.c
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2015-05-30 14:45:22 (GMT)
committerSerhiy Storchaka <storchaka@gmail.com>2015-05-30 14:45:22 (GMT)
commitfa494fd88384acc52cf9292d0c89e2961c8f747f (patch)
treea30958b83189caf872f34e7b94a1aeeef28ed3a9 /Modules/_threadmodule.c
parent50451eb91232b0e90c677419db19ed7b33a698a9 (diff)
downloadcpython-fa494fd88384acc52cf9292d0c89e2961c8f747f.zip
cpython-fa494fd88384acc52cf9292d0c89e2961c8f747f.tar.gz
cpython-fa494fd88384acc52cf9292d0c89e2961c8f747f.tar.bz2
Issue #24115: Update uses of PyObject_IsTrue(), PyObject_Not(),
PyObject_IsInstance(), PyObject_RichCompareBool() and _PyDict_Contains() to check for and handle errors correctly.
Diffstat (limited to 'Modules/_threadmodule.c')
-rw-r--r--Modules/_threadmodule.c18
1 files changed, 12 insertions, 6 deletions
diff --git a/Modules/_threadmodule.c b/Modules/_threadmodule.c
index 9925b0e..f80f76a 100644
--- a/Modules/_threadmodule.c
+++ b/Modules/_threadmodule.c
@@ -718,12 +718,18 @@ local_new(PyTypeObject *type, PyObject *args, PyObject *kw)
"_localdummy_destroyed", (PyCFunction) _localdummy_destroyed, METH_O
};
- if (type->tp_init == PyBaseObject_Type.tp_init
- && ((args && PyObject_IsTrue(args))
- || (kw && PyObject_IsTrue(kw)))) {
- PyErr_SetString(PyExc_TypeError,
- "Initialization arguments are not supported");
- return NULL;
+ if (type->tp_init == PyBaseObject_Type.tp_init) {
+ int rc = 0;
+ if (args != NULL)
+ rc = PyObject_IsTrue(args);
+ if (rc == 0 && kw != NULL)
+ rc = PyObject_IsTrue(kw);
+ if (rc != 0) {
+ if (rc > 0)
+ PyErr_SetString(PyExc_TypeError,
+ "Initialization arguments are not supported");
+ return NULL;
+ }
}
self = (localobject *)type->tp_alloc(type, 0);