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
2424 #include "../../../util/srcline.h"
2525 #include "../../../util/srccode.h"
2626
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−
35−PyMODINIT_FUNC initperf_trace_context(void);
36−#else
3727 #define _PyCapsule_GetPointer(arg1, arg2) \
3828 PyCapsule_GetPointer((arg1), (arg2))
3929 #define _PyBytes_FromStringAndSize(arg1, arg2) \
@@ -42,7 +32,6 @@ PyMODINIT_FUNC initperf_trace_context(void); · 2 unmodified lines
4232 PyUnicode_AsUTF8(arg)
4333
4434 PyMODINIT_FUNC PyInit_perf_trace_context(void);
45−#endif
4635
4736 static struct scripting_context *get_args(PyObject *args, const char *name, PyObject **arg2)
4837 {
@@ -213,12 +202,6 @@ static PyMethodDef ContextMethods[] = { · 164 unmodified lines
213202 { NULL, NULL, 0, NULL}
214203 };
215204
216−#if PY_MAJOR_VERSION < 3
217−PyMODINIT_FUNC initperf_trace_context(void)
218−{
219− (void) Py_InitModule("perf_trace_context", ContextMethods);
220−}
221−#else
222205 PyMODINIT_FUNC PyInit_perf_trace_context(void)
223206 {
224207 static struct PyModuleDef moduledef = {
@@ -240,4 +223,3 @@ PyMODINIT_FUNC PyInit_perf_trace_context(void) · 15 unmodified lines
240223
241224 return mod;
242225 }
243−#endif