Benjamin Peterson's patch to fix bug 3661, sys.call_tracing segfaults.

This commit is contained in:
Barry Warsaw 2008-10-17 01:29:56 +00:00
parent 460ce2abf7
commit e94a37f3a1
2 changed files with 4 additions and 1 deletions

View File

@ -166,6 +166,9 @@ class SysModuleTest(unittest.TestCase):
self.assert_(isinstance(v[3], int)) self.assert_(isinstance(v[3], int))
self.assert_(isinstance(v[4], str)) self.assert_(isinstance(v[4], str))
def test_call_tracing(self):
self.assertRaises(TypeError, sys.call_tracing, type, 2)
def test_dlopenflags(self): def test_dlopenflags(self):
if hasattr(sys, "setdlopenflags"): if hasattr(sys, "setdlopenflags"):
self.assert_(hasattr(sys, "getdlopenflags")) self.assert_(hasattr(sys, "getdlopenflags"))

View File

@ -783,7 +783,7 @@ static PyObject *
sys_call_tracing(PyObject *self, PyObject *args) sys_call_tracing(PyObject *self, PyObject *args)
{ {
PyObject *func, *funcargs; 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 NULL;
return _PyEval_CallTracing(func, funcargs); return _PyEval_CallTracing(func, funcargs);
} }