diff options
-rw-r--r-- | tools/perf/util/scripting-engines/trace-event-python.c | 13 |
1 files changed, 5 insertions, 8 deletions
diff --git a/tools/perf/util/scripting-engines/trace-event-python.c b/tools/perf/util/scripting-engines/trace-event-python.c index d402f64f9b46..33a414bbba3e 100644 --- a/tools/perf/util/scripting-engines/trace-event-python.c +++ b/tools/perf/util/scripting-engines/trace-event-python.c | |||
@@ -68,7 +68,7 @@ static void define_value(enum print_arg_type field_type, | |||
68 | if (field_type == PRINT_SYMBOL) | 68 | if (field_type == PRINT_SYMBOL) |
69 | handler_name = "define_symbolic_value"; | 69 | handler_name = "define_symbolic_value"; |
70 | 70 | ||
71 | t = PyTuple_New(MAX_FIELDS); | 71 | t = PyTuple_New(4); |
72 | if (!t) | 72 | if (!t) |
73 | Py_FatalError("couldn't create Python tuple"); | 73 | Py_FatalError("couldn't create Python tuple"); |
74 | 74 | ||
@@ -79,9 +79,6 @@ static void define_value(enum print_arg_type field_type, | |||
79 | PyTuple_SetItem(t, n++, PyInt_FromLong(value)); | 79 | PyTuple_SetItem(t, n++, PyInt_FromLong(value)); |
80 | PyTuple_SetItem(t, n++, PyString_FromString(field_str)); | 80 | PyTuple_SetItem(t, n++, PyString_FromString(field_str)); |
81 | 81 | ||
82 | if (_PyTuple_Resize(&t, n) == -1) | ||
83 | Py_FatalError("error resizing Python tuple"); | ||
84 | |||
85 | handler = PyDict_GetItemString(main_dict, handler_name); | 82 | handler = PyDict_GetItemString(main_dict, handler_name); |
86 | if (handler && PyCallable_Check(handler)) { | 83 | if (handler && PyCallable_Check(handler)) { |
87 | retval = PyObject_CallObject(handler, t); | 84 | retval = PyObject_CallObject(handler, t); |
@@ -116,7 +113,10 @@ static void define_field(enum print_arg_type field_type, | |||
116 | if (field_type == PRINT_SYMBOL) | 113 | if (field_type == PRINT_SYMBOL) |
117 | handler_name = "define_symbolic_field"; | 114 | handler_name = "define_symbolic_field"; |
118 | 115 | ||
119 | t = PyTuple_New(MAX_FIELDS); | 116 | if (field_type == PRINT_FLAGS) |
117 | t = PyTuple_New(3); | ||
118 | else | ||
119 | t = PyTuple_New(2); | ||
120 | if (!t) | 120 | if (!t) |
121 | Py_FatalError("couldn't create Python tuple"); | 121 | Py_FatalError("couldn't create Python tuple"); |
122 | 122 | ||
@@ -125,9 +125,6 @@ static void define_field(enum print_arg_type field_type, | |||
125 | if (field_type == PRINT_FLAGS) | 125 | if (field_type == PRINT_FLAGS) |
126 | PyTuple_SetItem(t, n++, PyString_FromString(delim)); | 126 | PyTuple_SetItem(t, n++, PyString_FromString(delim)); |
127 | 127 | ||
128 | if (_PyTuple_Resize(&t, n) == -1) | ||
129 | Py_FatalError("error resizing Python tuple"); | ||
130 | |||
131 | handler = PyDict_GetItemString(main_dict, handler_name); | 128 | handler = PyDict_GetItemString(main_dict, handler_name); |
132 | if (handler && PyCallable_Check(handler)) { | 129 | if (handler && PyCallable_Check(handler)) { |
133 | retval = PyObject_CallObject(handler, t); | 130 | retval = PyObject_CallObject(handler, t); |