Re: [PATCH] perf python: Fix redundant self-assignment in get_argument_count()

From: Arnaldo Carvalho de Melo

Date: Tue Sep 08 2026 - 17:08:47 EST


On Thu, Sep 03, 2026 at 04:13:50PM +0800, liujing wrote:
> From: Liu Jing <liujing@xxxxxxxxxxxxxxxxxxxx>
>
> In get_argument_count(), the variable code_obj is assigned to itself
> before being assigned the result of PyObject_GetAttrString(). This is
> a redundant self-assignment that appears to be a typo.
>
> Fix it by removing the redundant self-assignment.

Thanks, applied to perf-tools-next, for v7.4.

- Arnaldo

> Signed-off-by: Liu Jing <liujing@xxxxxxxxxxxxxxxxxxxx>
> ---
> --- a/tools/perf/util/scripting-engines/trace-event-python.c
> +++ b/tools/perf/util/scripting-engines/trace-event-python.c
> @@ -165,7 +165,7 @@
> {
> int arg_count = 0;
>
> - PyObject *code_obj = code_obj = PyObject_GetAttrString(handler, "__code__");
> + PyObject *code_obj = PyObject_GetAttrString(handler, "__code__");
> PyErr_Clear();
> if (code_obj) {
> PyObject *arg_count_obj = PyObject_GetAttrString(code_obj,
>
>
>