From: Barry Warsaw Date: Fri, 17 Oct 2008 01:29:56 +0000 (+0000) Subject: Benjamin Peterson's patch to fix bug 3661, sys.call_tracing segfaults. X-Git-Tag: v3.0rc2~63 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=e94a37f3a1b4bbd46f50922edcdf9293954fdd01;p=thirdparty%2FPython%2Fcpython.git Benjamin Peterson's patch to fix bug 3661, sys.call_tracing segfaults. --- diff --git a/Lib/test/test_sys.py b/Lib/test/test_sys.py index 5c1a8e9cacba..a8c19ee1a74c 100644 --- a/Lib/test/test_sys.py +++ b/Lib/test/test_sys.py @@ -166,6 +166,9 @@ class SysModuleTest(unittest.TestCase): self.assert_(isinstance(v[3], int)) self.assert_(isinstance(v[4], str)) + def test_call_tracing(self): + self.assertRaises(TypeError, sys.call_tracing, type, 2) + def test_dlopenflags(self): if hasattr(sys, "setdlopenflags"): self.assert_(hasattr(sys, "getdlopenflags")) diff --git a/Python/sysmodule.c b/Python/sysmodule.c index 10a87611c0d7..952f7e59045b 100644 --- a/Python/sysmodule.c +++ b/Python/sysmodule.c @@ -783,7 +783,7 @@ static PyObject * sys_call_tracing(PyObject *self, PyObject *args) { PyObject *func, *funcargs; - if (!PyArg_UnpackTuple(args, "call_tracing", 2, 2, &func, &funcargs)) + if (!PyArg_ParseTuple(args, "OO!:call_tracing", &func, &PyTuple_Type, &funcargs)) return NULL; return _PyEval_CallTracing(func, funcargs); }