]> granicus.if.org Git - python/commitdiff
Issue #7819: Check sys.call_tracing() arguments types.
authorVictor Stinner <victor.stinner@haypocalc.com>
Sun, 31 Jan 2010 22:32:15 +0000 (22:32 +0000)
committerVictor Stinner <victor.stinner@haypocalc.com>
Sun, 31 Jan 2010 22:32:15 +0000 (22:32 +0000)
py3k was already patched by issue #3661.

Lib/test/test_sys.py
Misc/NEWS
Python/sysmodule.c

index f58d90063f88913e1a36a8d3fd08f216447b7d1c..6b45d127ebd145aab9b00e0ee3b53fc1546c3c6f 100644 (file)
@@ -433,6 +433,10 @@ class SysModuleTest(unittest.TestCase):
         out = p.communicate()[0].strip()
         self.assertEqual(out, '?')
 
+    def test_call_tracing(self):
+        self.assertEqual(sys.call_tracing(str, (2,)), "2")
+        self.assertRaises(TypeError, sys.call_tracing, str, 2)
+
 
 class SizeofTest(unittest.TestCase):
 
index 5f64b8a8e1caca32669aa806d5cf381959cf067d..6b0f121e901d2e8901b1caef726db39d6b4d197c 100644 (file)
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -12,6 +12,8 @@ What's New in Python 2.7 alpha 3?
 Core and Builtins
 -----------------
 
+- Issue #7819: Check sys.call_tracing() arguments types.
+
 - Issue #7788: Fix an interpreter crash produced by deleting a list
   slice with very large step value.
 
index 3a991970cf418dbe3c9986ac4704afa083c089a8..65a9d8f93411d9c5f015edcb6b653f0effc2a557 100644 (file)
@@ -840,7 +840,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);
 }