[Tarantool-patches] [PATCH luajit 14/15] test: fix E741 errors by pycodestyle

Sergey Bronnikov sergeyb at tarantool.org
Thu Aug 3 17:34:05 MSK 2023


Hi, Igor

thanks for the patch!

On 8/3/23 10:30, Igor Munkin wrote:
> Fixed 3 occurrences of E741 ("ambiguous variable name 'l'") error
> reported by pycodestyle[1].
>
> [1]: https://www.flake8rules.com/rules/E741.html
>
> Signed-off-by: Igor Munkin <imun at tarantool.org>
> ---
>   src/luajit-gdb.py  |  6 +++---
>   src/luajit_lldb.py | 12 ++++++------
>   2 files changed, 9 insertions(+), 9 deletions(-)
>
> diff --git a/src/luajit-gdb.py b/src/luajit-gdb.py
> index a0c8f24e..2e0b145b 100644
> --- a/src/luajit-gdb.py
> +++ b/src/luajit-gdb.py
> @@ -233,15 +233,15 @@ def L(L=None):
>       # lookup a symbol for the main coroutine considering the host app
>       # XXX Fragile: though the loop initialization looks like a crap but it
>       # respects both Python 2 and Python 3.
> -    for l in [L] + list(map(lambda l: lookup(l), (
> +    for coroutine in [L] + list(map(lambda main: lookup(main), (

it is not obvious why variable "l" was replaced by "coroutine".

Could you elaborate? The same below


>           # LuaJIT main coro (see luajit/src/luajit.c)
>           'globalL',
>           # Tarantool main coro (see tarantool/src/lua/init.h)
>           'tarantool_L',
>           # TODO: Add more
>       ))):
> -        if l:
> -            return cast('lua_State *', l)
> +        if coroutine:
> +            return cast('lua_State *', coroutine)
>   
>   
>   def G(L):
> diff --git a/src/luajit_lldb.py b/src/luajit_lldb.py
> index 4787c62c..76fb3141 100644
> --- a/src/luajit_lldb.py
> +++ b/src/luajit_lldb.py
> @@ -453,15 +453,15 @@ def L(L=None):
>       # lookup a symbol for the main coroutine considering the host app
>       # XXX Fragile: though the loop initialization looks like a crap but it
>       # respects both Python 2 and Python 3.
> -    for l in [L] + list(map(lambda l: lookup_global(l), (
> +    for coroutine in [L] + list(map(lambda main: lookup_global(main), (
>           # LuaJIT main coro (see luajit/src/luajit.c)
>           'globalL',
>           # Tarantool main coro (see tarantool/src/lua/init.h)
>           'tarantool_L',
>           # TODO: Add more
>       ))):
> -        if l:
> -            return lua_State(l)
> +        if coroutine:
> +            return lua_State(coroutine)
>   
>   
>   def tou32(val):
> @@ -1066,9 +1066,9 @@ coroutine guest stack:
>   If L is ommited the main coroutine is used.
>       '''
>       def execute(self, debugger, args, result):
> -        l = self.parse(args)
> -        l_ptr = cast('lua_State *', l) if l is not None else None
> -        print('{}'.format(dump_stack(L(l_ptr))))
> +        coro = self.parse(args)
> +        coro_ptr = cast('lua_State *', coro) if coro is not None else None
> +        print('{}'.format(dump_stack(L(coro_ptr))))
>   
>   
>   def register_commands(debugger, commands):


More information about the Tarantool-patches mailing list