History

perf python: Remove python 2 scripting support

Python2 was deprecated 4 years ago, remove support and workarounds.

Ian Rogers committed 1 year ago

Commit e7e99431 parent 4c7f9ee3 files · +15 −139Browse files

Showing the changes to tools/perf/scripts/python (1 of 3 files). Show all

Unified · Split

tools/perf/scripts/python/Perf-Trace-Util/Context.c+0−18
@@ -24,16 +24,6 @@ · 23 unmodified lines
24#include "../../../util/srcline.h"24#include "../../../util/srcline.h"
25#include "../../../util/srccode.h"25#include "../../../util/srccode.h"
26 26
27#if PY_MAJOR_VERSION < 3
28#define _PyCapsule_GetPointer(arg1, arg2) \
29 PyCObject_AsVoidPtr(arg1)
30#define _PyBytes_FromStringAndSize(arg1, arg2) \
31 PyString_FromStringAndSize((arg1), (arg2))
32#define _PyUnicode_AsUTF8(arg) \
33 PyString_AsString(arg)
34
35PyMODINIT_FUNC initperf_trace_context(void);
36#else
37#define _PyCapsule_GetPointer(arg1, arg2) \27#define _PyCapsule_GetPointer(arg1, arg2) \
38 PyCapsule_GetPointer((arg1), (arg2))28 PyCapsule_GetPointer((arg1), (arg2))
39#define _PyBytes_FromStringAndSize(arg1, arg2) \29#define _PyBytes_FromStringAndSize(arg1, arg2) \
@@ -42,7 +32,6 @@ PyMODINIT_FUNC initperf_trace_context(void); · 2 unmodified lines
42 PyUnicode_AsUTF8(arg)32 PyUnicode_AsUTF8(arg)
43 33
44PyMODINIT_FUNC PyInit_perf_trace_context(void);34PyMODINIT_FUNC PyInit_perf_trace_context(void);
45#endif
46 35
47static struct scripting_context *get_args(PyObject *args, const char *name, PyObject **arg2)36static struct scripting_context *get_args(PyObject *args, const char *name, PyObject **arg2)
48{37{
@@ -213,12 +202,6 @@ static PyMethodDef ContextMethods[] = { · 164 unmodified lines
213 { NULL, NULL, 0, NULL}202 { NULL, NULL, 0, NULL}
214};203};
215 204
216#if PY_MAJOR_VERSION < 3
217PyMODINIT_FUNC initperf_trace_context(void)
218{
219 (void) Py_InitModule("perf_trace_context", ContextMethods);
220}
221#else
222PyMODINIT_FUNC PyInit_perf_trace_context(void)205PyMODINIT_FUNC PyInit_perf_trace_context(void)
223{206{
224 static struct PyModuleDef moduledef = {207 static struct PyModuleDef moduledef = {
@@ -240,4 +223,3 @@ PyMODINIT_FUNC PyInit_perf_trace_context(void) · 15 unmodified lines
240 223
241 return mod;224 return mod;
242}225}
243#endif