Re: [PATCH v1 1/2] perf python: Remove python 2 scripting support

From: James Clark
Date: Tue Oct 01 2024 - 08:53:21 EST




On 18/09/2024 11:54 pm, Ian Rogers wrote:
Python2 was deprecated 4 years ago, remove support and workarounds.

Signed-off-by: Ian Rogers <irogers@xxxxxxxxxx>
---
.../scripts/python/Perf-Trace-Util/Context.c | 18 -----
tools/perf/util/python.c | 73 +++----------------
.../scripting-engines/trace-event-python.c | 63 +---------------
3 files changed, 15 insertions(+), 139 deletions(-)

diff --git a/tools/perf/scripts/python/Perf-Trace-Util/Context.c b/tools/perf/scripts/python/Perf-Trace-Util/Context.c
index 3954bd1587ce..6d1c6be1d918 100644
--- a/tools/perf/scripts/python/Perf-Trace-Util/Context.c
+++ b/tools/perf/scripts/python/Perf-Trace-Util/Context.c
@@ -23,16 +23,6 @@
#include "../../../util/srcline.h"
#include "../../../util/srccode.h"
-#if PY_MAJOR_VERSION < 3
-#define _PyCapsule_GetPointer(arg1, arg2) \
- PyCObject_AsVoidPtr(arg1)
-#define _PyBytes_FromStringAndSize(arg1, arg2) \
- PyString_FromStringAndSize((arg1), (arg2))
-#define _PyUnicode_AsUTF8(arg) \
- PyString_AsString(arg)
-

If we know the workarounds were required should we add an error to prevent hard to debug build issues?

#if PY_MAJOR_VERSION < 3
#error "Python 2 not supported"
#endif

Or maybe something in the top level makefile?