Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit e94a37f

Browse files
committed
Benjamin Peterson's patch to fix bug 3661, sys.call_tracing segfaults.
1 parent 460ce2a commit e94a37f

2 files changed

Lines changed: 4 additions & 1 deletion

File tree

Lib/test/test_sys.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -166,6 +166,9 @@ def test_getwindowsversion(self):
166166
self.assert_(isinstance(v[3], int))
167167
self.assert_(isinstance(v[4], str))
168168

169+
def test_call_tracing(self):
170+
self.assertRaises(TypeError, sys.call_tracing, type, 2)
171+
169172
def test_dlopenflags(self):
170173
if hasattr(sys, "setdlopenflags"):
171174
self.assert_(hasattr(sys, "getdlopenflags"))

Python/sysmodule.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -783,7 +783,7 @@ static PyObject *
783783
sys_call_tracing(PyObject *self, PyObject *args)
784784
{
785785
PyObject *func, *funcargs;
786-
if (!PyArg_UnpackTuple(args, "call_tracing", 2, 2, &func, &funcargs))
786+
if (!PyArg_ParseTuple(args, "OO!:call_tracing", &func, &PyTuple_Type, &funcargs))
787787
return NULL;
788788
return _PyEval_CallTracing(func, funcargs);
789789
}

0 commit comments

Comments
 (0)