summaryrefslogtreecommitdiffstats
path: root/Modules
diff options
context:
space:
mode:
authorBenjamin Peterson <benjamin@python.org>2008-08-23 20:32:27 (GMT)
committerBenjamin Peterson <benjamin@python.org>2008-08-23 20:32:27 (GMT)
commit6784eb79c91b63f468f91dad61c39932dfaad58a (patch)
tree8cb13c57b9dc735a5fc44b8fe814fc0d349e4cfa /Modules
parentbc74e5be1a7c1647e87218c8548fa50163cbf781 (diff)
downloadcpython-6784eb79c91b63f468f91dad61c39932dfaad58a.zip
cpython-6784eb79c91b63f468f91dad61c39932dfaad58a.tar.gz
cpython-6784eb79c91b63f468f91dad61c39932dfaad58a.tar.bz2
#3643 add more checks to _testcapi to prevent segfaults
Author: Victor Stinner Reviewer: Benjamin Peterson
Diffstat (limited to 'Modules')
-rw-r--r--Modules/_testcapimodule.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/Modules/_testcapimodule.c b/Modules/_testcapimodule.c
index 494937a..995d789 100644
--- a/Modules/_testcapimodule.c
+++ b/Modules/_testcapimodule.c
@@ -961,6 +961,10 @@ exception_print(PyObject *self, PyObject *args)
if (!PyArg_ParseTuple(args, "O:exception_print",
&value))
return NULL;
+ if (!PyExceptionInstance_Check(value)) {
+ PyErr_Format(PyExc_TypeError, "an exception instance is required");
+ return NULL;
+ }
tb = PyException_GetTraceback(value);
PyErr_Display((PyObject *) Py_TYPE(value), value, tb);