* [Tarantool-patches] [PATCH luajit 01/15] test: fix E122 errors by pycodestyle
2023-08-03 7:30 [Tarantool-patches] [PATCH luajit 00/15] Add flake8 linter Igor Munkin via Tarantool-patches
@ 2023-08-03 7:30 ` Igor Munkin via Tarantool-patches
2023-08-03 14:25 ` Sergey Bronnikov via Tarantool-patches
2023-08-03 15:49 ` Maxim Kokryashkin via Tarantool-patches
2023-08-03 7:30 ` [Tarantool-patches] [PATCH luajit 02/15] test: fix E128 " Igor Munkin via Tarantool-patches
` (14 subsequent siblings)
15 siblings, 2 replies; 68+ messages in thread
From: Igor Munkin via Tarantool-patches @ 2023-08-03 7:30 UTC (permalink / raw)
To: Maxim Kokryashkin, Sergey Bronnikov; +Cc: tarantool-patches
Fixed the only occurrence of E122 ("continuation line missing
indentation or outdented") error reported by pycodestyle[1].
[1]: https://www.flake8rules.com/rules/E122.html
Signed-off-by: Igor Munkin <imun@tarantool.org>
---
src/luajit_lldb.py | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/luajit_lldb.py b/src/luajit_lldb.py
index 9ee10269..77d92785 100644
--- a/src/luajit_lldb.py
+++ b/src/luajit_lldb.py
@@ -617,8 +617,8 @@ LJ_T = {
def itypemap(o):
if LJ_64 and not LJ_GC64:
- return LJ_T['NUMX'] if tvisnumber(o) \
- else LJ_T['LIGHTUD'] if tvislightud(o) else itype(o)
+ return LJ_T['NUMX'] if tvisnumber(o) \
+ else LJ_T['LIGHTUD'] if tvislightud(o) else itype(o)
else:
return LJ_T['NUMX'] if tvisnumber(o) else itype(o)
--
2.30.2
^ permalink raw reply [flat|nested] 68+ messages in thread
* Re: [Tarantool-patches] [PATCH luajit 01/15] test: fix E122 errors by pycodestyle
2023-08-03 7:30 ` [Tarantool-patches] [PATCH luajit 01/15] test: fix E122 errors by pycodestyle Igor Munkin via Tarantool-patches
@ 2023-08-03 14:25 ` Sergey Bronnikov via Tarantool-patches
2023-08-03 15:49 ` Maxim Kokryashkin via Tarantool-patches
1 sibling, 0 replies; 68+ messages in thread
From: Sergey Bronnikov via Tarantool-patches @ 2023-08-03 14:25 UTC (permalink / raw)
To: Igor Munkin, Maxim Kokryashkin; +Cc: tarantool-patches
LGTM
On 8/3/23 10:30, Igor Munkin wrote:
> Fixed the only occurrence of E122 ("continuation line missing
> indentation or outdented") error reported by pycodestyle[1].
>
> [1]: https://www.flake8rules.com/rules/E122.html
>
> Signed-off-by: Igor Munkin <imun@tarantool.org>
> ---
> src/luajit_lldb.py | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/src/luajit_lldb.py b/src/luajit_lldb.py
> index 9ee10269..77d92785 100644
> --- a/src/luajit_lldb.py
> +++ b/src/luajit_lldb.py
> @@ -617,8 +617,8 @@ LJ_T = {
>
> def itypemap(o):
> if LJ_64 and not LJ_GC64:
> - return LJ_T['NUMX'] if tvisnumber(o) \
> - else LJ_T['LIGHTUD'] if tvislightud(o) else itype(o)
> + return LJ_T['NUMX'] if tvisnumber(o) \
> + else LJ_T['LIGHTUD'] if tvislightud(o) else itype(o)
> else:
> return LJ_T['NUMX'] if tvisnumber(o) else itype(o)
>
^ permalink raw reply [flat|nested] 68+ messages in thread
* Re: [Tarantool-patches] [PATCH luajit 01/15] test: fix E122 errors by pycodestyle
2023-08-03 7:30 ` [Tarantool-patches] [PATCH luajit 01/15] test: fix E122 errors by pycodestyle Igor Munkin via Tarantool-patches
2023-08-03 14:25 ` Sergey Bronnikov via Tarantool-patches
@ 2023-08-03 15:49 ` Maxim Kokryashkin via Tarantool-patches
1 sibling, 0 replies; 68+ messages in thread
From: Maxim Kokryashkin via Tarantool-patches @ 2023-08-03 15:49 UTC (permalink / raw)
To: Igor Munkin; +Cc: tarantool-patches
[-- Attachment #1: Type: text/plain, Size: 965 bytes --]
Hi, Igor!
Thanks for the patch!
LGTM
--
Best regards,
Maxim Kokryashkin
>
>>Fixed the only occurrence of E122 ("continuation line missing
>>indentation or outdented") error reported by pycodestyle[1].
>>
>>[1]: https://www.flake8rules.com/rules/E122.html
>>
>>Signed-off-by: Igor Munkin < imun@tarantool.org >
>>---
>> src/luajit_lldb.py | 4 ++--
>> 1 file changed, 2 insertions(+), 2 deletions(-)
>>
>>diff --git a/src/luajit_lldb.py b/src/luajit_lldb.py
>>index 9ee10269..77d92785 100644
>>--- a/src/luajit_lldb.py
>>+++ b/src/luajit_lldb.py
>>@@ -617,8 +617,8 @@ LJ_T = {
>>
>> def itypemap(o):
>> if LJ_64 and not LJ_GC64:
>>- return LJ_T['NUMX'] if tvisnumber(o) \
>>- else LJ_T['LIGHTUD'] if tvislightud(o) else itype(o)
>>+ return LJ_T['NUMX'] if tvisnumber(o) \
>>+ else LJ_T['LIGHTUD'] if tvislightud(o) else itype(o)
>> else:
>> return LJ_T['NUMX'] if tvisnumber(o) else itype(o)
>>
>>--
>>2.30.2
>
[-- Attachment #2: Type: text/html, Size: 1757 bytes --]
^ permalink raw reply [flat|nested] 68+ messages in thread
* [Tarantool-patches] [PATCH luajit 02/15] test: fix E128 errors by pycodestyle
2023-08-03 7:30 [Tarantool-patches] [PATCH luajit 00/15] Add flake8 linter Igor Munkin via Tarantool-patches
2023-08-03 7:30 ` [Tarantool-patches] [PATCH luajit 01/15] test: fix E122 errors by pycodestyle Igor Munkin via Tarantool-patches
@ 2023-08-03 7:30 ` Igor Munkin via Tarantool-patches
2023-08-03 14:26 ` Sergey Bronnikov via Tarantool-patches
2023-08-03 15:52 ` Maxim Kokryashkin via Tarantool-patches
2023-08-03 7:30 ` [Tarantool-patches] [PATCH luajit 03/15] test: fix E201 and E202 " Igor Munkin via Tarantool-patches
` (13 subsequent siblings)
15 siblings, 2 replies; 68+ messages in thread
From: Igor Munkin via Tarantool-patches @ 2023-08-03 7:30 UTC (permalink / raw)
To: Maxim Kokryashkin, Sergey Bronnikov; +Cc: tarantool-patches
Fixed 8 occurrences of E128 ("continuation line under-indented for
visual indent") error reported by pycodestyle[1].
[1]: https://www.flake8rules.com/rules/E128.html
Signed-off-by: Igor Munkin <imun@tarantool.org>
---
src/luajit-gdb.py | 13 ++++++-------
src/luajit_lldb.py | 6 +++---
2 files changed, 9 insertions(+), 10 deletions(-)
diff --git a/src/luajit-gdb.py b/src/luajit-gdb.py
index 96ee2289..b84fdc93 100644
--- a/src/luajit-gdb.py
+++ b/src/luajit-gdb.py
@@ -118,7 +118,7 @@ def bc_a(ins):
def frame_ftsz(framelink):
return cast('ptrdiff_t', framelink['ftsz'] if LJ_FR2 \
- else framelink['fr']['tp']['ftsz'])
+ else framelink['fr']['tp']['ftsz'])
def frame_pc(framelink):
return cast('BCIns *', frame_ftsz(framelink)) if LJ_FR2 \
@@ -182,11 +182,11 @@ def mref(typename, obj):
def gcref(obj):
return cast('GCobj *', obj['gcptr64'] if LJ_GC64
- else cast('uintptr_t', obj['gcptr32']))
+ else cast('uintptr_t', obj['gcptr32']))
def gcval(obj):
return cast('GCobj *', obj['gcptr64'] & LJ_GCVMASK if LJ_GC64
- else cast('uintptr_t', obj['gcptr32']))
+ else cast('uintptr_t', obj['gcptr32']))
def gcnext(obj):
return gcref(obj)['gch']['nextgc']
@@ -212,9 +212,8 @@ def J(g):
typeGG = gtype('GG_State')
return cast('jit_State *', int(cast('char *', g))
- - int(typeGG['g'].bitpos / 8)
- + int(typeGG['J'].bitpos / 8)
- )
+ - int(typeGG['g'].bitpos / 8)
+ + int(typeGG['J'].bitpos / 8))
def vm_state(g):
return {
@@ -282,7 +281,7 @@ def funcproto(func):
assert(func['ffid'] == 0)
return cast('GCproto *',
- mref('char *', func['pc']) - gdb.lookup_type('GCproto').sizeof)
+ mref('char *', func['pc']) - gdb.lookup_type('GCproto').sizeof)
def gclistlen(root, end=0x0):
count = 0
diff --git a/src/luajit_lldb.py b/src/luajit_lldb.py
index 77d92785..3f636546 100644
--- a/src/luajit_lldb.py
+++ b/src/luajit_lldb.py
@@ -355,11 +355,11 @@ def dbg_eval(expr):
def gcval(obj):
return cast(GCobjPtr, cast('uintptr_t', obj.gcptr & LJ_GCVMASK) if LJ_GC64
- else cast('uintptr_t', obj.gcptr))
+ else cast('uintptr_t', obj.gcptr))
def gcref(obj):
return cast(GCobjPtr, obj.gcptr if LJ_GC64
- else cast('uintptr_t', obj.gcptr))
+ else cast('uintptr_t', obj.gcptr))
def gcnext(obj):
return gcref(obj).gch.nextgc
@@ -658,7 +658,7 @@ def bc_a(ins):
def frame_ftsz(framelink):
return vtou64(cast('ptrdiff_t', framelink.ftsz if LJ_FR2 \
- else framelink.fr.tp.ftsz))
+ else framelink.fr.tp.ftsz))
def frame_pc(framelink):
return cast(BCInsPtr, frame_ftsz(framelink)) if LJ_FR2 \
--
2.30.2
^ permalink raw reply [flat|nested] 68+ messages in thread
* Re: [Tarantool-patches] [PATCH luajit 02/15] test: fix E128 errors by pycodestyle
2023-08-03 7:30 ` [Tarantool-patches] [PATCH luajit 02/15] test: fix E128 " Igor Munkin via Tarantool-patches
@ 2023-08-03 14:26 ` Sergey Bronnikov via Tarantool-patches
2023-08-03 15:52 ` Maxim Kokryashkin via Tarantool-patches
1 sibling, 0 replies; 68+ messages in thread
From: Sergey Bronnikov via Tarantool-patches @ 2023-08-03 14:26 UTC (permalink / raw)
To: Igor Munkin, Maxim Kokryashkin; +Cc: tarantool-patches
LGTM
On 8/3/23 10:30, Igor Munkin wrote:
> Fixed 8 occurrences of E128 ("continuation line under-indented for
> visual indent") error reported by pycodestyle[1].
>
> [1]: https://www.flake8rules.com/rules/E128.html
>
> Signed-off-by: Igor Munkin <imun@tarantool.org>
> ---
> src/luajit-gdb.py | 13 ++++++-------
> src/luajit_lldb.py | 6 +++---
> 2 files changed, 9 insertions(+), 10 deletions(-)
>
> diff --git a/src/luajit-gdb.py b/src/luajit-gdb.py
> index 96ee2289..b84fdc93 100644
> --- a/src/luajit-gdb.py
> +++ b/src/luajit-gdb.py
> @@ -118,7 +118,7 @@ def bc_a(ins):
>
> def frame_ftsz(framelink):
> return cast('ptrdiff_t', framelink['ftsz'] if LJ_FR2 \
> - else framelink['fr']['tp']['ftsz'])
> + else framelink['fr']['tp']['ftsz'])
>
> def frame_pc(framelink):
> return cast('BCIns *', frame_ftsz(framelink)) if LJ_FR2 \
> @@ -182,11 +182,11 @@ def mref(typename, obj):
>
> def gcref(obj):
> return cast('GCobj *', obj['gcptr64'] if LJ_GC64
> - else cast('uintptr_t', obj['gcptr32']))
> + else cast('uintptr_t', obj['gcptr32']))
>
> def gcval(obj):
> return cast('GCobj *', obj['gcptr64'] & LJ_GCVMASK if LJ_GC64
> - else cast('uintptr_t', obj['gcptr32']))
> + else cast('uintptr_t', obj['gcptr32']))
>
> def gcnext(obj):
> return gcref(obj)['gch']['nextgc']
> @@ -212,9 +212,8 @@ def J(g):
> typeGG = gtype('GG_State')
>
> return cast('jit_State *', int(cast('char *', g))
> - - int(typeGG['g'].bitpos / 8)
> - + int(typeGG['J'].bitpos / 8)
> - )
> + - int(typeGG['g'].bitpos / 8)
> + + int(typeGG['J'].bitpos / 8))
>
> def vm_state(g):
> return {
> @@ -282,7 +281,7 @@ def funcproto(func):
> assert(func['ffid'] == 0)
>
> return cast('GCproto *',
> - mref('char *', func['pc']) - gdb.lookup_type('GCproto').sizeof)
> + mref('char *', func['pc']) - gdb.lookup_type('GCproto').sizeof)
>
> def gclistlen(root, end=0x0):
> count = 0
> diff --git a/src/luajit_lldb.py b/src/luajit_lldb.py
> index 77d92785..3f636546 100644
> --- a/src/luajit_lldb.py
> +++ b/src/luajit_lldb.py
> @@ -355,11 +355,11 @@ def dbg_eval(expr):
>
> def gcval(obj):
> return cast(GCobjPtr, cast('uintptr_t', obj.gcptr & LJ_GCVMASK) if LJ_GC64
> - else cast('uintptr_t', obj.gcptr))
> + else cast('uintptr_t', obj.gcptr))
>
> def gcref(obj):
> return cast(GCobjPtr, obj.gcptr if LJ_GC64
> - else cast('uintptr_t', obj.gcptr))
> + else cast('uintptr_t', obj.gcptr))
>
> def gcnext(obj):
> return gcref(obj).gch.nextgc
> @@ -658,7 +658,7 @@ def bc_a(ins):
>
> def frame_ftsz(framelink):
> return vtou64(cast('ptrdiff_t', framelink.ftsz if LJ_FR2 \
> - else framelink.fr.tp.ftsz))
> + else framelink.fr.tp.ftsz))
>
> def frame_pc(framelink):
> return cast(BCInsPtr, frame_ftsz(framelink)) if LJ_FR2 \
^ permalink raw reply [flat|nested] 68+ messages in thread
* Re: [Tarantool-patches] [PATCH luajit 02/15] test: fix E128 errors by pycodestyle
2023-08-03 7:30 ` [Tarantool-patches] [PATCH luajit 02/15] test: fix E128 " Igor Munkin via Tarantool-patches
2023-08-03 14:26 ` Sergey Bronnikov via Tarantool-patches
@ 2023-08-03 15:52 ` Maxim Kokryashkin via Tarantool-patches
1 sibling, 0 replies; 68+ messages in thread
From: Maxim Kokryashkin via Tarantool-patches @ 2023-08-03 15:52 UTC (permalink / raw)
To: Igor Munkin; +Cc: tarantool-patches
[-- Attachment #1: Type: text/plain, Size: 2976 bytes --]
Hi, Igor!
Thanks for the patch!
LGTM
--
Best regards,
Maxim Kokryashkin
>
>>Fixed 8 occurrences of E128 ("continuation line under-indented for
>>visual indent") error reported by pycodestyle[1].
>>
>>[1]: https://www.flake8rules.com/rules/E128.html
>>
>>Signed-off-by: Igor Munkin < imun@tarantool.org >
>>---
>> src/luajit-gdb.py | 13 ++++++-------
>> src/luajit_lldb.py | 6 +++---
>> 2 files changed, 9 insertions(+), 10 deletions(-)
>>
>>diff --git a/src/luajit-gdb.py b/src/luajit-gdb.py
>>index 96ee2289..b84fdc93 100644
>>--- a/src/luajit-gdb.py
>>+++ b/src/luajit-gdb.py
>>@@ -118,7 +118,7 @@ def bc_a(ins):
>>
>> def frame_ftsz(framelink):
>> return cast('ptrdiff_t', framelink['ftsz'] if LJ_FR2 \
>>- else framelink['fr']['tp']['ftsz'])
>>+ else framelink['fr']['tp']['ftsz'])
>>
>> def frame_pc(framelink):
>> return cast('BCIns *', frame_ftsz(framelink)) if LJ_FR2 \
>>@@ -182,11 +182,11 @@ def mref(typename, obj):
>>
>> def gcref(obj):
>> return cast('GCobj *', obj['gcptr64'] if LJ_GC64
>>- else cast('uintptr_t', obj['gcptr32']))
>>+ else cast('uintptr_t', obj['gcptr32']))
>>
>> def gcval(obj):
>> return cast('GCobj *', obj['gcptr64'] & LJ_GCVMASK if LJ_GC64
>>- else cast('uintptr_t', obj['gcptr32']))
>>+ else cast('uintptr_t', obj['gcptr32']))
>>
>> def gcnext(obj):
>> return gcref(obj)['gch']['nextgc']
>>@@ -212,9 +212,8 @@ def J(g):
>> typeGG = gtype('GG_State')
>>
>> return cast('jit_State *', int(cast('char *', g))
>>- - int(typeGG['g'].bitpos / 8)
>>- + int(typeGG['J'].bitpos / 8)
>>- )
>>+ - int(typeGG['g'].bitpos / 8)
>>+ + int(typeGG['J'].bitpos / 8))
>>
>> def vm_state(g):
>> return {
>>@@ -282,7 +281,7 @@ def funcproto(func):
>> assert(func['ffid'] == 0)
>>
>> return cast('GCproto *',
>>- mref('char *', func['pc']) - gdb.lookup_type('GCproto').sizeof)
>>+ mref('char *', func['pc']) - gdb.lookup_type('GCproto').sizeof)
>>
>> def gclistlen(root, end=0x0):
>> count = 0
>>diff --git a/src/luajit_lldb.py b/src/luajit_lldb.py
>>index 77d92785..3f636546 100644
>>--- a/src/luajit_lldb.py
>>+++ b/src/luajit_lldb.py
>>@@ -355,11 +355,11 @@ def dbg_eval(expr):
>>
>> def gcval(obj):
>> return cast(GCobjPtr, cast('uintptr_t', obj.gcptr & LJ_GCVMASK) if LJ_GC64
>>- else cast('uintptr_t', obj.gcptr))
>>+ else cast('uintptr_t', obj.gcptr))
>>
>> def gcref(obj):
>> return cast(GCobjPtr, obj.gcptr if LJ_GC64
>>- else cast('uintptr_t', obj.gcptr))
>>+ else cast('uintptr_t', obj.gcptr))
>>
>> def gcnext(obj):
>> return gcref(obj).gch.nextgc
>>@@ -658,7 +658,7 @@ def bc_a(ins):
>>
>> def frame_ftsz(framelink):
>> return vtou64(cast('ptrdiff_t', framelink.ftsz if LJ_FR2 \
>>- else framelink.fr.tp.ftsz))
>>+ else framelink.fr.tp.ftsz))
>>
>> def frame_pc(framelink):
>> return cast(BCInsPtr, frame_ftsz(framelink)) if LJ_FR2 \
>>--
>>2.30.2
>
[-- Attachment #2: Type: text/html, Size: 4163 bytes --]
^ permalink raw reply [flat|nested] 68+ messages in thread
* [Tarantool-patches] [PATCH luajit 03/15] test: fix E201 and E202 errors by pycodestyle
2023-08-03 7:30 [Tarantool-patches] [PATCH luajit 00/15] Add flake8 linter Igor Munkin via Tarantool-patches
2023-08-03 7:30 ` [Tarantool-patches] [PATCH luajit 01/15] test: fix E122 errors by pycodestyle Igor Munkin via Tarantool-patches
2023-08-03 7:30 ` [Tarantool-patches] [PATCH luajit 02/15] test: fix E128 " Igor Munkin via Tarantool-patches
@ 2023-08-03 7:30 ` Igor Munkin via Tarantool-patches
2023-08-03 14:26 ` Sergey Bronnikov via Tarantool-patches
2023-08-03 15:53 ` Maxim Kokryashkin via Tarantool-patches
2023-08-03 7:30 ` [Tarantool-patches] [PATCH luajit 04/15] test: fix E203 " Igor Munkin via Tarantool-patches
` (12 subsequent siblings)
15 siblings, 2 replies; 68+ messages in thread
From: Igor Munkin via Tarantool-patches @ 2023-08-03 7:30 UTC (permalink / raw)
To: Maxim Kokryashkin, Sergey Bronnikov; +Cc: tarantool-patches
Fixed the only occurrence of E202 ("whitespace before ')'"), 7
occurrences of E201 ("whitespace after '['") and 7 occurrences of E202
("whitespace before ']'") errors reported by pycodestyle[1][2].
[1]: https://www.flake8rules.com/rules/E201.html
[2]: https://www.flake8rules.com/rules/E202.html
Signed-off-by: Igor Munkin <imun@tarantool.org>
---
src/luajit-gdb.py | 14 +++++++-------
src/luajit_lldb.py | 12 ++++++------
2 files changed, 13 insertions(+), 13 deletions(-)
diff --git a/src/luajit-gdb.py b/src/luajit-gdb.py
index b84fdc93..198578b1 100644
--- a/src/luajit-gdb.py
+++ b/src/luajit-gdb.py
@@ -195,7 +195,7 @@ 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 l in [L] + list(map(lambda l: lookup(l), (
# LuaJIT main coro (see luajit/src/luajit.c)
'globalL',
# Tarantool main coro (see tarantool/src/lua/init.h)
@@ -504,20 +504,20 @@ def dump_stack(L, base=None, top=None):
def dump_gc(g):
gc = g['gc']
- stats = [ '{key}: {value}'.format(key = f, value = gc[f]) for f in (
+ stats = ['{key}: {value}'.format(key = f, value = gc[f]) for f in (
'total', 'threshold', 'debt', 'estimate', 'stepmul', 'pause'
- ) ]
+ )]
- stats += [ 'sweepstr: {sweepstr}/{strmask}'.format(
+ stats += ['sweepstr: {sweepstr}/{strmask}'.format(
sweepstr = gc['sweepstr'],
# String hash mask (size of hash table - 1).
strmask = g['strmask'] + 1,
- ) ]
+ )]
- stats += [ '{key}: {number} objects'.format(
+ stats += ['{key}: {number} objects'.format(
key = stat,
number = handler(gc[stat])
- ) for stat, handler in gclen.items() ]
+ ) for stat, handler in gclen.items()]
return '\n'.join(map(lambda s: '\t' + s, stats))
diff --git a/src/luajit_lldb.py b/src/luajit_lldb.py
index 3f636546..2887723b 100644
--- a/src/luajit_lldb.py
+++ b/src/luajit_lldb.py
@@ -211,7 +211,7 @@ c_structs = {
}
for cls in c_structs.keys():
- globals()[cls] = type(cls, (Struct, ), {'metainfo': c_structs[cls]} )
+ globals()[cls] = type(cls, (Struct, ), {'metainfo': c_structs[cls]})
for cls in Struct.__subclasses__():
ptr_name = cls.__name__ + 'Ptr'
@@ -394,16 +394,16 @@ def dump_gc(g):
'total', 'threshold', 'debt', 'estimate', 'stepmul', 'pause'
)]
- stats += [ 'sweepstr: {sweepstr}/{strmask}'.format(
+ stats += ['sweepstr: {sweepstr}/{strmask}'.format(
sweepstr = gc.sweepstr,
# String hash mask (size of hash table - 1).
strmask = g.strmask + 1,
- ) ]
+ )]
- stats += [ '{key}: {number} objects'.format(
+ stats += ['{key}: {number} objects'.format(
key = stat,
number = handler(getattr(gc, stat))
- ) for stat, handler in gclen.items() ]
+ ) for stat, handler in gclen.items()]
return '\n'.join(map(lambda s: '\t' + s, stats))
def mref(typename, obj):
@@ -424,7 +424,7 @@ 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 l in [L] + list(map(lambda l: lookup_global(l), (
# LuaJIT main coro (see luajit/src/luajit.c)
'globalL',
# Tarantool main coro (see tarantool/src/lua/init.h)
--
2.30.2
^ permalink raw reply [flat|nested] 68+ messages in thread
* Re: [Tarantool-patches] [PATCH luajit 03/15] test: fix E201 and E202 errors by pycodestyle
2023-08-03 7:30 ` [Tarantool-patches] [PATCH luajit 03/15] test: fix E201 and E202 " Igor Munkin via Tarantool-patches
@ 2023-08-03 14:26 ` Sergey Bronnikov via Tarantool-patches
2023-08-03 15:53 ` Maxim Kokryashkin via Tarantool-patches
1 sibling, 0 replies; 68+ messages in thread
From: Sergey Bronnikov via Tarantool-patches @ 2023-08-03 14:26 UTC (permalink / raw)
To: Igor Munkin, Maxim Kokryashkin; +Cc: tarantool-patches
LGTM
On 8/3/23 10:30, Igor Munkin wrote:
> Fixed the only occurrence of E202 ("whitespace before ')'"), 7
> occurrences of E201 ("whitespace after '['") and 7 occurrences of E202
> ("whitespace before ']'") errors reported by pycodestyle[1][2].
>
> [1]: https://www.flake8rules.com/rules/E201.html
> [2]: https://www.flake8rules.com/rules/E202.html
>
> Signed-off-by: Igor Munkin <imun@tarantool.org>
> ---
> src/luajit-gdb.py | 14 +++++++-------
> src/luajit_lldb.py | 12 ++++++------
> 2 files changed, 13 insertions(+), 13 deletions(-)
>
> diff --git a/src/luajit-gdb.py b/src/luajit-gdb.py
> index b84fdc93..198578b1 100644
> --- a/src/luajit-gdb.py
> +++ b/src/luajit-gdb.py
> @@ -195,7 +195,7 @@ 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 l in [L] + list(map(lambda l: lookup(l), (
> # LuaJIT main coro (see luajit/src/luajit.c)
> 'globalL',
> # Tarantool main coro (see tarantool/src/lua/init.h)
> @@ -504,20 +504,20 @@ def dump_stack(L, base=None, top=None):
>
> def dump_gc(g):
> gc = g['gc']
> - stats = [ '{key}: {value}'.format(key = f, value = gc[f]) for f in (
> + stats = ['{key}: {value}'.format(key = f, value = gc[f]) for f in (
> 'total', 'threshold', 'debt', 'estimate', 'stepmul', 'pause'
> - ) ]
> + )]
>
> - stats += [ 'sweepstr: {sweepstr}/{strmask}'.format(
> + stats += ['sweepstr: {sweepstr}/{strmask}'.format(
> sweepstr = gc['sweepstr'],
> # String hash mask (size of hash table - 1).
> strmask = g['strmask'] + 1,
> - ) ]
> + )]
>
> - stats += [ '{key}: {number} objects'.format(
> + stats += ['{key}: {number} objects'.format(
> key = stat,
> number = handler(gc[stat])
> - ) for stat, handler in gclen.items() ]
> + ) for stat, handler in gclen.items()]
>
> return '\n'.join(map(lambda s: '\t' + s, stats))
>
> diff --git a/src/luajit_lldb.py b/src/luajit_lldb.py
> index 3f636546..2887723b 100644
> --- a/src/luajit_lldb.py
> +++ b/src/luajit_lldb.py
> @@ -211,7 +211,7 @@ c_structs = {
> }
>
> for cls in c_structs.keys():
> - globals()[cls] = type(cls, (Struct, ), {'metainfo': c_structs[cls]} )
> + globals()[cls] = type(cls, (Struct, ), {'metainfo': c_structs[cls]})
>
> for cls in Struct.__subclasses__():
> ptr_name = cls.__name__ + 'Ptr'
> @@ -394,16 +394,16 @@ def dump_gc(g):
> 'total', 'threshold', 'debt', 'estimate', 'stepmul', 'pause'
> )]
>
> - stats += [ 'sweepstr: {sweepstr}/{strmask}'.format(
> + stats += ['sweepstr: {sweepstr}/{strmask}'.format(
> sweepstr = gc.sweepstr,
> # String hash mask (size of hash table - 1).
> strmask = g.strmask + 1,
> - ) ]
> + )]
>
> - stats += [ '{key}: {number} objects'.format(
> + stats += ['{key}: {number} objects'.format(
> key = stat,
> number = handler(getattr(gc, stat))
> - ) for stat, handler in gclen.items() ]
> + ) for stat, handler in gclen.items()]
> return '\n'.join(map(lambda s: '\t' + s, stats))
>
> def mref(typename, obj):
> @@ -424,7 +424,7 @@ 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 l in [L] + list(map(lambda l: lookup_global(l), (
> # LuaJIT main coro (see luajit/src/luajit.c)
> 'globalL',
> # Tarantool main coro (see tarantool/src/lua/init.h)
^ permalink raw reply [flat|nested] 68+ messages in thread
* Re: [Tarantool-patches] [PATCH luajit 03/15] test: fix E201 and E202 errors by pycodestyle
2023-08-03 7:30 ` [Tarantool-patches] [PATCH luajit 03/15] test: fix E201 and E202 " Igor Munkin via Tarantool-patches
2023-08-03 14:26 ` Sergey Bronnikov via Tarantool-patches
@ 2023-08-03 15:53 ` Maxim Kokryashkin via Tarantool-patches
1 sibling, 0 replies; 68+ messages in thread
From: Maxim Kokryashkin via Tarantool-patches @ 2023-08-03 15:53 UTC (permalink / raw)
To: Igor Munkin; +Cc: tarantool-patches
[-- Attachment #1: Type: text/plain, Size: 4043 bytes --]
Hi, Igor!
Thanks for the patch!
LGTM
--
Best regards,
Maxim Kokryashkin
>
>>Fixed the only occurrence of E202 ("whitespace before ')'"), 7
>>occurrences of E201 ("whitespace after '['") and 7 occurrences of E202
>>("whitespace before ']'") errors reported by pycodestyle[1][2].
>>
>>[1]: https://www.flake8rules.com/rules/E201.html
>>[2]: https://www.flake8rules.com/rules/E202.html
>>
>>Signed-off-by: Igor Munkin < imun@tarantool.org >
>>---
>> src/luajit-gdb.py | 14 +++++++-------
>> src/luajit_lldb.py | 12 ++++++------
>> 2 files changed, 13 insertions(+), 13 deletions(-)
>>
>>diff --git a/src/luajit-gdb.py b/src/luajit-gdb.py
>>index b84fdc93..198578b1 100644
>>--- a/src/luajit-gdb.py
>>+++ b/src/luajit-gdb.py
>>@@ -195,7 +195,7 @@ 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 l in [L] + list(map(lambda l: lookup(l), (
>> # LuaJIT main coro (see luajit/src/luajit.c)
>> 'globalL',
>> # Tarantool main coro (see tarantool/src/lua/init.h)
>>@@ -504,20 +504,20 @@ def dump_stack(L, base=None, top=None):
>>
>> def dump_gc(g):
>> gc = g['gc']
>>- stats = [ '{key}: {value}'.format(key = f, value = gc[f]) for f in (
>>+ stats = ['{key}: {value}'.format(key = f, value = gc[f]) for f in (
>> 'total', 'threshold', 'debt', 'estimate', 'stepmul', 'pause'
>>- ) ]
>>+ )]
>>
>>- stats += [ 'sweepstr: {sweepstr}/{strmask}'.format(
>>+ stats += ['sweepstr: {sweepstr}/{strmask}'.format(
>> sweepstr = gc['sweepstr'],
>> # String hash mask (size of hash table - 1).
>> strmask = g['strmask'] + 1,
>>- ) ]
>>+ )]
>>
>>- stats += [ '{key}: {number} objects'.format(
>>+ stats += ['{key}: {number} objects'.format(
>> key = stat,
>> number = handler(gc[stat])
>>- ) for stat, handler in gclen.items() ]
>>+ ) for stat, handler in gclen.items()]
>>
>> return '\n'.join(map(lambda s: '\t' + s, stats))
>>
>>diff --git a/src/luajit_lldb.py b/src/luajit_lldb.py
>>index 3f636546..2887723b 100644
>>--- a/src/luajit_lldb.py
>>+++ b/src/luajit_lldb.py
>>@@ -211,7 +211,7 @@ c_structs = {
>> }
>>
>> for cls in c_structs.keys():
>>- globals()[cls] = type(cls, (Struct, ), {'metainfo': c_structs[cls]} )
>>+ globals()[cls] = type(cls, (Struct, ), {'metainfo': c_structs[cls]})
>>
>> for cls in Struct.__subclasses__():
>> ptr_name = cls.__name__ + 'Ptr'
>>@@ -394,16 +394,16 @@ def dump_gc(g):
>> 'total', 'threshold', 'debt', 'estimate', 'stepmul', 'pause'
>> )]
>>
>>- stats += [ 'sweepstr: {sweepstr}/{strmask}'.format(
>>+ stats += ['sweepstr: {sweepstr}/{strmask}'.format(
>> sweepstr = gc.sweepstr,
>> # String hash mask (size of hash table - 1).
>> strmask = g.strmask + 1,
>>- ) ]
>>+ )]
>>
>>- stats += [ '{key}: {number} objects'.format(
>>+ stats += ['{key}: {number} objects'.format(
>> key = stat,
>> number = handler(getattr(gc, stat))
>>- ) for stat, handler in gclen.items() ]
>>+ ) for stat, handler in gclen.items()]
>> return '\n'.join(map(lambda s: '\t' + s, stats))
>>
>> def mref(typename, obj):
>>@@ -424,7 +424,7 @@ 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 l in [L] + list(map(lambda l: lookup_global(l), (
>> # LuaJIT main coro (see luajit/src/luajit.c)
>> 'globalL',
>> # Tarantool main coro (see tarantool/src/lua/init.h)
>>--
>>2.30.2
>
[-- Attachment #2: Type: text/html, Size: 5809 bytes --]
^ permalink raw reply [flat|nested] 68+ messages in thread
* [Tarantool-patches] [PATCH luajit 04/15] test: fix E203 errors by pycodestyle
2023-08-03 7:30 [Tarantool-patches] [PATCH luajit 00/15] Add flake8 linter Igor Munkin via Tarantool-patches
` (2 preceding siblings ...)
2023-08-03 7:30 ` [Tarantool-patches] [PATCH luajit 03/15] test: fix E201 and E202 " Igor Munkin via Tarantool-patches
@ 2023-08-03 7:30 ` Igor Munkin via Tarantool-patches
2023-08-03 14:26 ` Sergey Bronnikov via Tarantool-patches
2023-08-03 15:55 ` Maxim Kokryashkin via Tarantool-patches
2023-08-03 7:30 ` [Tarantool-patches] [PATCH luajit 05/15] test: fix E231 " Igor Munkin via Tarantool-patches
` (11 subsequent siblings)
15 siblings, 2 replies; 68+ messages in thread
From: Igor Munkin via Tarantool-patches @ 2023-08-03 7:30 UTC (permalink / raw)
To: Maxim Kokryashkin, Sergey Bronnikov; +Cc: tarantool-patches
Fixed 36 occurrences of E203 ("whitespace before ':'") error reported
by pycodestyle[1]. Furthermore, many other parts have been re-aligned
the similar way to be in sync with the default code style.
[1]: https://www.flake8rules.com/rules/E203.html
Signed-off-by: Igor Munkin <imun@tarantool.org>
---
src/luajit-gdb.py | 98 +++++++++++++++++++++----------------------
src/luajit_lldb.py | 102 ++++++++++++++++++++++-----------------------
2 files changed, 100 insertions(+), 100 deletions(-)
diff --git a/src/luajit-gdb.py b/src/luajit-gdb.py
index 198578b1..09899f58 100644
--- a/src/luajit-gdb.py
+++ b/src/luajit-gdb.py
@@ -65,20 +65,20 @@ def strx64(val):
# Types {{{
LJ_T = {
- 'NIL' : i2notu32(0),
- 'FALSE' : i2notu32(1),
- 'TRUE' : i2notu32(2),
- 'LIGHTUD' : i2notu32(3),
- 'STR' : i2notu32(4),
- 'UPVAL' : i2notu32(5),
- 'THREAD' : i2notu32(6),
- 'PROTO' : i2notu32(7),
- 'FUNC' : i2notu32(8),
- 'TRACE' : i2notu32(9),
- 'CDATA' : i2notu32(10),
- 'TAB' : i2notu32(11),
- 'UDATA' : i2notu32(12),
- 'NUMX' : i2notu32(13),
+ 'NIL': i2notu32(0),
+ 'FALSE': i2notu32(1),
+ 'TRUE': i2notu32(2),
+ 'LIGHTUD': i2notu32(3),
+ 'STR': i2notu32(4),
+ 'UPVAL': i2notu32(5),
+ 'THREAD': i2notu32(6),
+ 'PROTO': i2notu32(7),
+ 'FUNC': i2notu32(8),
+ 'TRACE': i2notu32(9),
+ 'CDATA': i2notu32(10),
+ 'TAB': i2notu32(11),
+ 'UDATA': i2notu32(12),
+ 'NUMX': i2notu32(13),
}
def typenames(value):
@@ -95,22 +95,22 @@ FRAME_P = 0x4
FRAME_TYPEP = FRAME_TYPE | FRAME_P
FRAME = {
- 'LUA': 0x0,
- 'C': 0x1,
- 'CONT': 0x2,
- 'VARG': 0x3,
- 'LUAP': 0x4,
- 'CP': 0x5,
- 'PCALL': 0x6,
+ 'LUA': 0x0,
+ 'C': 0x1,
+ 'CONT': 0x2,
+ 'VARG': 0x3,
+ 'LUAP': 0x4,
+ 'CP': 0x5,
+ 'PCALL': 0x6,
'PCALLH': 0x7,
}
def frametypes(ft):
return {
- FRAME['LUA'] : 'L',
- FRAME['C'] : 'C',
- FRAME['CONT'] : 'M',
- FRAME['VARG'] : 'V',
+ FRAME['LUA']: 'L',
+ FRAME['C']: 'C',
+ FRAME['CONT']: 'M',
+ FRAME['VARG']: 'V',
}.get(ft, '?')
def bc_a(ins):
@@ -299,12 +299,12 @@ def gcringlen(root):
return 1 + gclistlen(gcnext(root), gcref(root))
gclen = {
- 'root': gclistlen,
- 'gray': gclistlen,
+ 'root': gclistlen,
+ 'gray': gclistlen,
'grayagain': gclistlen,
- 'weak': gclistlen,
+ 'weak': gclistlen,
# XXX: gc.mmudata is a ring-list.
- 'mmudata': gcringlen,
+ 'mmudata': gcringlen,
}
# The generator that implements frame iterator.
@@ -410,20 +410,20 @@ def dump_lj_invalid(tv):
# }}}
dumpers = {
- 'LJ_TNIL': dump_lj_tnil,
- 'LJ_TFALSE': dump_lj_tfalse,
- 'LJ_TTRUE': dump_lj_ttrue,
+ 'LJ_TNIL': dump_lj_tnil,
+ 'LJ_TFALSE': dump_lj_tfalse,
+ 'LJ_TTRUE': dump_lj_ttrue,
'LJ_TLIGHTUD': dump_lj_tlightud,
- 'LJ_TSTR': dump_lj_tstr,
- 'LJ_TUPVAL': dump_lj_tupval,
- 'LJ_TTHREAD': dump_lj_tthread,
- 'LJ_TPROTO': dump_lj_tproto,
- 'LJ_TFUNC': dump_lj_tfunc,
- 'LJ_TTRACE': dump_lj_ttrace,
- 'LJ_TCDATA': dump_lj_tcdata,
- 'LJ_TTAB': dump_lj_ttab,
- 'LJ_TUDATA': dump_lj_tudata,
- 'LJ_TNUMX': dump_lj_tnumx,
+ 'LJ_TSTR': dump_lj_tstr,
+ 'LJ_TUPVAL': dump_lj_tupval,
+ 'LJ_TTHREAD': dump_lj_tthread,
+ 'LJ_TPROTO': dump_lj_tproto,
+ 'LJ_TFUNC': dump_lj_tfunc,
+ 'LJ_TTRACE': dump_lj_ttrace,
+ 'LJ_TCDATA': dump_lj_tcdata,
+ 'LJ_TTAB': dump_lj_ttab,
+ 'LJ_TUDATA': dump_lj_tudata,
+ 'LJ_TNUMX': dump_lj_tnumx,
}
def dump_tvalue(tvalue):
@@ -695,8 +695,8 @@ The command requires no args and dumps current VM and GC states
g = G(L(None))
gdb.write('{}\n'.format('\n'.join(
map(lambda t: '{} state: {}'.format(*t), {
- 'VM': vm_state(g),
- 'GC': gc_state(g),
+ 'VM': vm_state(g),
+ 'GC': gc_state(g),
'JIT': jit_state(g),
}.items())
)))
@@ -785,13 +785,13 @@ def init(commands):
def load(event=None):
init({
- 'lj-arch': LJDumpArch,
- 'lj-tv': LJDumpTValue,
- 'lj-str': LJDumpString,
- 'lj-tab': LJDumpTable,
+ 'lj-arch': LJDumpArch,
+ 'lj-tv': LJDumpTValue,
+ 'lj-str': LJDumpString,
+ 'lj-tab': LJDumpTable,
'lj-stack': LJDumpStack,
'lj-state': LJState,
- 'lj-gc': LJGC,
+ 'lj-gc': LJGC,
})
load(None)
diff --git a/src/luajit_lldb.py b/src/luajit_lldb.py
index 2887723b..b9c8a0b9 100644
--- a/src/luajit_lldb.py
+++ b/src/luajit_lldb.py
@@ -88,8 +88,8 @@ class MetaStruct(type):
def make_general(field, tp):
builtin = {
- 'uint': 'unsigned',
- 'int': 'signed',
+ 'uint': 'unsigned',
+ 'int': 'signed',
'string': 'value',
}
if tp in builtin.keys():
@@ -380,12 +380,12 @@ def gcringlen(root):
return 1 + gclistlen(gcnext(root), gcref(root))
gclen = {
- 'root': gclistlen,
- 'gray': gclistlen,
+ 'root': gclistlen,
+ 'gray': gclistlen,
'grayagain': gclistlen,
- 'weak': gclistlen,
+ 'weak': gclistlen,
# XXX: gc.mmudata is a ring-list.
- 'mmudata': gcringlen,
+ 'mmudata': gcringlen,
}
def dump_gc(g):
@@ -582,37 +582,37 @@ def dump_lj_invalid(tv):
return 'not valid type @ {}'.format(strx64(gcval(tv.gcr)))
dumpers = {
- 'LJ_TNIL': dump_lj_tnil,
- 'LJ_TFALSE': dump_lj_tfalse,
- 'LJ_TTRUE': dump_lj_ttrue,
+ 'LJ_TNIL': dump_lj_tnil,
+ 'LJ_TFALSE': dump_lj_tfalse,
+ 'LJ_TTRUE': dump_lj_ttrue,
'LJ_TLIGHTUD': dump_lj_tlightud,
- 'LJ_TSTR': dump_lj_tstr,
- 'LJ_TUPVAL': dump_lj_tupval,
- 'LJ_TTHREAD': dump_lj_tthread,
- 'LJ_TPROTO': dump_lj_tproto,
- 'LJ_TFUNC': dump_lj_tfunc,
- 'LJ_TTRACE': dump_lj_ttrace,
- 'LJ_TCDATA': dump_lj_tcdata,
- 'LJ_TTAB': dump_lj_ttab,
- 'LJ_TUDATA': dump_lj_tudata,
- 'LJ_TNUMX': dump_lj_tnumx,
+ 'LJ_TSTR': dump_lj_tstr,
+ 'LJ_TUPVAL': dump_lj_tupval,
+ 'LJ_TTHREAD': dump_lj_tthread,
+ 'LJ_TPROTO': dump_lj_tproto,
+ 'LJ_TFUNC': dump_lj_tfunc,
+ 'LJ_TTRACE': dump_lj_ttrace,
+ 'LJ_TCDATA': dump_lj_tcdata,
+ 'LJ_TTAB': dump_lj_ttab,
+ 'LJ_TUDATA': dump_lj_tudata,
+ 'LJ_TNUMX': dump_lj_tnumx,
}
LJ_T = {
- 'NIL' : i2notu32(0),
- 'FALSE' : i2notu32(1),
- 'TRUE' : i2notu32(2),
- 'LIGHTUD' : i2notu32(3),
- 'STR' : i2notu32(4),
- 'UPVAL' : i2notu32(5),
- 'THREAD' : i2notu32(6),
- 'PROTO' : i2notu32(7),
- 'FUNC' : i2notu32(8),
- 'TRACE' : i2notu32(9),
- 'CDATA' : i2notu32(10),
- 'TAB' : i2notu32(11),
- 'UDATA' : i2notu32(12),
- 'NUMX' : i2notu32(13),
+ 'NIL': i2notu32(0),
+ 'FALSE': i2notu32(1),
+ 'TRUE': i2notu32(2),
+ 'LIGHTUD': i2notu32(3),
+ 'STR': i2notu32(4),
+ 'UPVAL': i2notu32(5),
+ 'THREAD': i2notu32(6),
+ 'PROTO': i2notu32(7),
+ 'FUNC': i2notu32(8),
+ 'TRACE': i2notu32(9),
+ 'CDATA': i2notu32(10),
+ 'TAB': i2notu32(11),
+ 'UDATA': i2notu32(12),
+ 'NUMX': i2notu32(13),
}
def itypemap(o):
@@ -635,22 +635,22 @@ FRAME_P = 0x4
FRAME_TYPEP = FRAME_TYPE | FRAME_P
FRAME = {
- 'LUA': 0x0,
- 'C': 0x1,
- 'CONT': 0x2,
- 'VARG': 0x3,
- 'LUAP': 0x4,
- 'CP': 0x5,
- 'PCALL': 0x6,
+ 'LUA': 0x0,
+ 'C': 0x1,
+ 'CONT': 0x2,
+ 'VARG': 0x3,
+ 'LUAP': 0x4,
+ 'CP': 0x5,
+ 'PCALL': 0x6,
'PCALLH': 0x7,
}
def frametypes(ft):
return {
- FRAME['LUA'] : 'L',
- FRAME['C'] : 'C',
- FRAME['CONT'] : 'M',
- FRAME['VARG'] : 'V',
+ FRAME['LUA']: 'L',
+ FRAME['C']: 'C',
+ FRAME['CONT']: 'M',
+ FRAME['VARG']: 'V',
}.get(ft, '?')
def bc_a(ins):
@@ -838,8 +838,8 @@ The command requires no args and dumps current VM and GC states
g = G(L(None))
print('{}'.format('\n'.join(
map(lambda t: '{} state: {}'.format(*t), {
- 'VM': vm_state(g),
- 'GC': gc_state(g),
+ 'VM': vm_state(g),
+ 'GC': gc_state(g),
'JIT': jit_state(g),
}.items())
)))
@@ -1024,12 +1024,12 @@ def configure(debugger):
def __lldb_init_module(debugger, internal_dict):
configure(debugger)
register_commands(debugger, {
- 'lj-tv': LJDumpTValue,
+ 'lj-tv': LJDumpTValue,
'lj-state': LJState,
- 'lj-arch': LJDumpArch,
- 'lj-gc': LJGC,
- 'lj-str': LJDumpString,
- 'lj-tab': LJDumpTable,
+ 'lj-arch': LJDumpArch,
+ 'lj-gc': LJGC,
+ 'lj-str': LJDumpString,
+ 'lj-tab': LJDumpTable,
'lj-stack': LJDumpStack,
})
print('luajit_lldb.py is successfully loaded')
--
2.30.2
^ permalink raw reply [flat|nested] 68+ messages in thread
* Re: [Tarantool-patches] [PATCH luajit 04/15] test: fix E203 errors by pycodestyle
2023-08-03 7:30 ` [Tarantool-patches] [PATCH luajit 04/15] test: fix E203 " Igor Munkin via Tarantool-patches
@ 2023-08-03 14:26 ` Sergey Bronnikov via Tarantool-patches
2023-08-03 15:55 ` Maxim Kokryashkin via Tarantool-patches
1 sibling, 0 replies; 68+ messages in thread
From: Sergey Bronnikov via Tarantool-patches @ 2023-08-03 14:26 UTC (permalink / raw)
To: Igor Munkin, Maxim Kokryashkin; +Cc: tarantool-patches
LGTM
On 8/3/23 10:30, Igor Munkin wrote:
> Fixed 36 occurrences of E203 ("whitespace before ':'") error reported
> by pycodestyle[1]. Furthermore, many other parts have been re-aligned
> the similar way to be in sync with the default code style.
>
> [1]: https://www.flake8rules.com/rules/E203.html
>
> Signed-off-by: Igor Munkin <imun@tarantool.org>
> ---
> src/luajit-gdb.py | 98 +++++++++++++++++++++----------------------
> src/luajit_lldb.py | 102 ++++++++++++++++++++++-----------------------
> 2 files changed, 100 insertions(+), 100 deletions(-)
>
> diff --git a/src/luajit-gdb.py b/src/luajit-gdb.py
> index 198578b1..09899f58 100644
> --- a/src/luajit-gdb.py
> +++ b/src/luajit-gdb.py
> @@ -65,20 +65,20 @@ def strx64(val):
> # Types {{{
>
> LJ_T = {
> - 'NIL' : i2notu32(0),
> - 'FALSE' : i2notu32(1),
> - 'TRUE' : i2notu32(2),
> - 'LIGHTUD' : i2notu32(3),
> - 'STR' : i2notu32(4),
> - 'UPVAL' : i2notu32(5),
> - 'THREAD' : i2notu32(6),
> - 'PROTO' : i2notu32(7),
> - 'FUNC' : i2notu32(8),
> - 'TRACE' : i2notu32(9),
> - 'CDATA' : i2notu32(10),
> - 'TAB' : i2notu32(11),
> - 'UDATA' : i2notu32(12),
> - 'NUMX' : i2notu32(13),
> + 'NIL': i2notu32(0),
> + 'FALSE': i2notu32(1),
> + 'TRUE': i2notu32(2),
> + 'LIGHTUD': i2notu32(3),
> + 'STR': i2notu32(4),
> + 'UPVAL': i2notu32(5),
> + 'THREAD': i2notu32(6),
> + 'PROTO': i2notu32(7),
> + 'FUNC': i2notu32(8),
> + 'TRACE': i2notu32(9),
> + 'CDATA': i2notu32(10),
> + 'TAB': i2notu32(11),
> + 'UDATA': i2notu32(12),
> + 'NUMX': i2notu32(13),
> }
>
> def typenames(value):
> @@ -95,22 +95,22 @@ FRAME_P = 0x4
> FRAME_TYPEP = FRAME_TYPE | FRAME_P
>
> FRAME = {
> - 'LUA': 0x0,
> - 'C': 0x1,
> - 'CONT': 0x2,
> - 'VARG': 0x3,
> - 'LUAP': 0x4,
> - 'CP': 0x5,
> - 'PCALL': 0x6,
> + 'LUA': 0x0,
> + 'C': 0x1,
> + 'CONT': 0x2,
> + 'VARG': 0x3,
> + 'LUAP': 0x4,
> + 'CP': 0x5,
> + 'PCALL': 0x6,
> 'PCALLH': 0x7,
> }
>
> def frametypes(ft):
> return {
> - FRAME['LUA'] : 'L',
> - FRAME['C'] : 'C',
> - FRAME['CONT'] : 'M',
> - FRAME['VARG'] : 'V',
> + FRAME['LUA']: 'L',
> + FRAME['C']: 'C',
> + FRAME['CONT']: 'M',
> + FRAME['VARG']: 'V',
> }.get(ft, '?')
>
> def bc_a(ins):
> @@ -299,12 +299,12 @@ def gcringlen(root):
> return 1 + gclistlen(gcnext(root), gcref(root))
>
> gclen = {
> - 'root': gclistlen,
> - 'gray': gclistlen,
> + 'root': gclistlen,
> + 'gray': gclistlen,
> 'grayagain': gclistlen,
> - 'weak': gclistlen,
> + 'weak': gclistlen,
> # XXX: gc.mmudata is a ring-list.
> - 'mmudata': gcringlen,
> + 'mmudata': gcringlen,
> }
>
> # The generator that implements frame iterator.
> @@ -410,20 +410,20 @@ def dump_lj_invalid(tv):
> # }}}
>
> dumpers = {
> - 'LJ_TNIL': dump_lj_tnil,
> - 'LJ_TFALSE': dump_lj_tfalse,
> - 'LJ_TTRUE': dump_lj_ttrue,
> + 'LJ_TNIL': dump_lj_tnil,
> + 'LJ_TFALSE': dump_lj_tfalse,
> + 'LJ_TTRUE': dump_lj_ttrue,
> 'LJ_TLIGHTUD': dump_lj_tlightud,
> - 'LJ_TSTR': dump_lj_tstr,
> - 'LJ_TUPVAL': dump_lj_tupval,
> - 'LJ_TTHREAD': dump_lj_tthread,
> - 'LJ_TPROTO': dump_lj_tproto,
> - 'LJ_TFUNC': dump_lj_tfunc,
> - 'LJ_TTRACE': dump_lj_ttrace,
> - 'LJ_TCDATA': dump_lj_tcdata,
> - 'LJ_TTAB': dump_lj_ttab,
> - 'LJ_TUDATA': dump_lj_tudata,
> - 'LJ_TNUMX': dump_lj_tnumx,
> + 'LJ_TSTR': dump_lj_tstr,
> + 'LJ_TUPVAL': dump_lj_tupval,
> + 'LJ_TTHREAD': dump_lj_tthread,
> + 'LJ_TPROTO': dump_lj_tproto,
> + 'LJ_TFUNC': dump_lj_tfunc,
> + 'LJ_TTRACE': dump_lj_ttrace,
> + 'LJ_TCDATA': dump_lj_tcdata,
> + 'LJ_TTAB': dump_lj_ttab,
> + 'LJ_TUDATA': dump_lj_tudata,
> + 'LJ_TNUMX': dump_lj_tnumx,
> }
>
> def dump_tvalue(tvalue):
> @@ -695,8 +695,8 @@ The command requires no args and dumps current VM and GC states
> g = G(L(None))
> gdb.write('{}\n'.format('\n'.join(
> map(lambda t: '{} state: {}'.format(*t), {
> - 'VM': vm_state(g),
> - 'GC': gc_state(g),
> + 'VM': vm_state(g),
> + 'GC': gc_state(g),
> 'JIT': jit_state(g),
> }.items())
> )))
> @@ -785,13 +785,13 @@ def init(commands):
>
> def load(event=None):
> init({
> - 'lj-arch': LJDumpArch,
> - 'lj-tv': LJDumpTValue,
> - 'lj-str': LJDumpString,
> - 'lj-tab': LJDumpTable,
> + 'lj-arch': LJDumpArch,
> + 'lj-tv': LJDumpTValue,
> + 'lj-str': LJDumpString,
> + 'lj-tab': LJDumpTable,
> 'lj-stack': LJDumpStack,
> 'lj-state': LJState,
> - 'lj-gc': LJGC,
> + 'lj-gc': LJGC,
> })
>
> load(None)
> diff --git a/src/luajit_lldb.py b/src/luajit_lldb.py
> index 2887723b..b9c8a0b9 100644
> --- a/src/luajit_lldb.py
> +++ b/src/luajit_lldb.py
> @@ -88,8 +88,8 @@ class MetaStruct(type):
>
> def make_general(field, tp):
> builtin = {
> - 'uint': 'unsigned',
> - 'int': 'signed',
> + 'uint': 'unsigned',
> + 'int': 'signed',
> 'string': 'value',
> }
> if tp in builtin.keys():
> @@ -380,12 +380,12 @@ def gcringlen(root):
> return 1 + gclistlen(gcnext(root), gcref(root))
>
> gclen = {
> - 'root': gclistlen,
> - 'gray': gclistlen,
> + 'root': gclistlen,
> + 'gray': gclistlen,
> 'grayagain': gclistlen,
> - 'weak': gclistlen,
> + 'weak': gclistlen,
> # XXX: gc.mmudata is a ring-list.
> - 'mmudata': gcringlen,
> + 'mmudata': gcringlen,
> }
>
> def dump_gc(g):
> @@ -582,37 +582,37 @@ def dump_lj_invalid(tv):
> return 'not valid type @ {}'.format(strx64(gcval(tv.gcr)))
>
> dumpers = {
> - 'LJ_TNIL': dump_lj_tnil,
> - 'LJ_TFALSE': dump_lj_tfalse,
> - 'LJ_TTRUE': dump_lj_ttrue,
> + 'LJ_TNIL': dump_lj_tnil,
> + 'LJ_TFALSE': dump_lj_tfalse,
> + 'LJ_TTRUE': dump_lj_ttrue,
> 'LJ_TLIGHTUD': dump_lj_tlightud,
> - 'LJ_TSTR': dump_lj_tstr,
> - 'LJ_TUPVAL': dump_lj_tupval,
> - 'LJ_TTHREAD': dump_lj_tthread,
> - 'LJ_TPROTO': dump_lj_tproto,
> - 'LJ_TFUNC': dump_lj_tfunc,
> - 'LJ_TTRACE': dump_lj_ttrace,
> - 'LJ_TCDATA': dump_lj_tcdata,
> - 'LJ_TTAB': dump_lj_ttab,
> - 'LJ_TUDATA': dump_lj_tudata,
> - 'LJ_TNUMX': dump_lj_tnumx,
> + 'LJ_TSTR': dump_lj_tstr,
> + 'LJ_TUPVAL': dump_lj_tupval,
> + 'LJ_TTHREAD': dump_lj_tthread,
> + 'LJ_TPROTO': dump_lj_tproto,
> + 'LJ_TFUNC': dump_lj_tfunc,
> + 'LJ_TTRACE': dump_lj_ttrace,
> + 'LJ_TCDATA': dump_lj_tcdata,
> + 'LJ_TTAB': dump_lj_ttab,
> + 'LJ_TUDATA': dump_lj_tudata,
> + 'LJ_TNUMX': dump_lj_tnumx,
> }
>
> LJ_T = {
> - 'NIL' : i2notu32(0),
> - 'FALSE' : i2notu32(1),
> - 'TRUE' : i2notu32(2),
> - 'LIGHTUD' : i2notu32(3),
> - 'STR' : i2notu32(4),
> - 'UPVAL' : i2notu32(5),
> - 'THREAD' : i2notu32(6),
> - 'PROTO' : i2notu32(7),
> - 'FUNC' : i2notu32(8),
> - 'TRACE' : i2notu32(9),
> - 'CDATA' : i2notu32(10),
> - 'TAB' : i2notu32(11),
> - 'UDATA' : i2notu32(12),
> - 'NUMX' : i2notu32(13),
> + 'NIL': i2notu32(0),
> + 'FALSE': i2notu32(1),
> + 'TRUE': i2notu32(2),
> + 'LIGHTUD': i2notu32(3),
> + 'STR': i2notu32(4),
> + 'UPVAL': i2notu32(5),
> + 'THREAD': i2notu32(6),
> + 'PROTO': i2notu32(7),
> + 'FUNC': i2notu32(8),
> + 'TRACE': i2notu32(9),
> + 'CDATA': i2notu32(10),
> + 'TAB': i2notu32(11),
> + 'UDATA': i2notu32(12),
> + 'NUMX': i2notu32(13),
> }
>
> def itypemap(o):
> @@ -635,22 +635,22 @@ FRAME_P = 0x4
> FRAME_TYPEP = FRAME_TYPE | FRAME_P
>
> FRAME = {
> - 'LUA': 0x0,
> - 'C': 0x1,
> - 'CONT': 0x2,
> - 'VARG': 0x3,
> - 'LUAP': 0x4,
> - 'CP': 0x5,
> - 'PCALL': 0x6,
> + 'LUA': 0x0,
> + 'C': 0x1,
> + 'CONT': 0x2,
> + 'VARG': 0x3,
> + 'LUAP': 0x4,
> + 'CP': 0x5,
> + 'PCALL': 0x6,
> 'PCALLH': 0x7,
> }
>
> def frametypes(ft):
> return {
> - FRAME['LUA'] : 'L',
> - FRAME['C'] : 'C',
> - FRAME['CONT'] : 'M',
> - FRAME['VARG'] : 'V',
> + FRAME['LUA']: 'L',
> + FRAME['C']: 'C',
> + FRAME['CONT']: 'M',
> + FRAME['VARG']: 'V',
> }.get(ft, '?')
>
> def bc_a(ins):
> @@ -838,8 +838,8 @@ The command requires no args and dumps current VM and GC states
> g = G(L(None))
> print('{}'.format('\n'.join(
> map(lambda t: '{} state: {}'.format(*t), {
> - 'VM': vm_state(g),
> - 'GC': gc_state(g),
> + 'VM': vm_state(g),
> + 'GC': gc_state(g),
> 'JIT': jit_state(g),
> }.items())
> )))
> @@ -1024,12 +1024,12 @@ def configure(debugger):
> def __lldb_init_module(debugger, internal_dict):
> configure(debugger)
> register_commands(debugger, {
> - 'lj-tv': LJDumpTValue,
> + 'lj-tv': LJDumpTValue,
> 'lj-state': LJState,
> - 'lj-arch': LJDumpArch,
> - 'lj-gc': LJGC,
> - 'lj-str': LJDumpString,
> - 'lj-tab': LJDumpTable,
> + 'lj-arch': LJDumpArch,
> + 'lj-gc': LJGC,
> + 'lj-str': LJDumpString,
> + 'lj-tab': LJDumpTable,
> 'lj-stack': LJDumpStack,
> })
> print('luajit_lldb.py is successfully loaded')
^ permalink raw reply [flat|nested] 68+ messages in thread
* Re: [Tarantool-patches] [PATCH luajit 04/15] test: fix E203 errors by pycodestyle
2023-08-03 7:30 ` [Tarantool-patches] [PATCH luajit 04/15] test: fix E203 " Igor Munkin via Tarantool-patches
2023-08-03 14:26 ` Sergey Bronnikov via Tarantool-patches
@ 2023-08-03 15:55 ` Maxim Kokryashkin via Tarantool-patches
1 sibling, 0 replies; 68+ messages in thread
From: Maxim Kokryashkin via Tarantool-patches @ 2023-08-03 15:55 UTC (permalink / raw)
To: Igor Munkin; +Cc: tarantool-patches
[-- Attachment #1: Type: text/plain, Size: 9121 bytes --]
Hi, Igor!
Thanks for the patch!
LGTM
--
Best regards,
Maxim Kokryashkin
>
>>Fixed 36 occurrences of E203 ("whitespace before ':'") error reported
>>by pycodestyle[1]. Furthermore, many other parts have been re-aligned
>>the similar way to be in sync with the default code style.
>>
>>[1]: https://www.flake8rules.com/rules/E203.html
>>
>>Signed-off-by: Igor Munkin < imun@tarantool.org >
>>---
>> src/luajit-gdb.py | 98 +++++++++++++++++++++----------------------
>> src/luajit_lldb.py | 102 ++++++++++++++++++++++-----------------------
>> 2 files changed, 100 insertions(+), 100 deletions(-)
>>
>>diff --git a/src/luajit-gdb.py b/src/luajit-gdb.py
>>index 198578b1..09899f58 100644
>>--- a/src/luajit-gdb.py
>>+++ b/src/luajit-gdb.py
>>@@ -65,20 +65,20 @@ def strx64(val):
>> # Types {{{
>>
>> LJ_T = {
>>- 'NIL' : i2notu32(0),
>>- 'FALSE' : i2notu32(1),
>>- 'TRUE' : i2notu32(2),
>>- 'LIGHTUD' : i2notu32(3),
>>- 'STR' : i2notu32(4),
>>- 'UPVAL' : i2notu32(5),
>>- 'THREAD' : i2notu32(6),
>>- 'PROTO' : i2notu32(7),
>>- 'FUNC' : i2notu32(8),
>>- 'TRACE' : i2notu32(9),
>>- 'CDATA' : i2notu32(10),
>>- 'TAB' : i2notu32(11),
>>- 'UDATA' : i2notu32(12),
>>- 'NUMX' : i2notu32(13),
>>+ 'NIL': i2notu32(0),
>>+ 'FALSE': i2notu32(1),
>>+ 'TRUE': i2notu32(2),
>>+ 'LIGHTUD': i2notu32(3),
>>+ 'STR': i2notu32(4),
>>+ 'UPVAL': i2notu32(5),
>>+ 'THREAD': i2notu32(6),
>>+ 'PROTO': i2notu32(7),
>>+ 'FUNC': i2notu32(8),
>>+ 'TRACE': i2notu32(9),
>>+ 'CDATA': i2notu32(10),
>>+ 'TAB': i2notu32(11),
>>+ 'UDATA': i2notu32(12),
>>+ 'NUMX': i2notu32(13),
>> }
>>
>> def typenames(value):
>>@@ -95,22 +95,22 @@ FRAME_P = 0x4
>> FRAME_TYPEP = FRAME_TYPE | FRAME_P
>>
>> FRAME = {
>>- 'LUA': 0x0,
>>- 'C': 0x1,
>>- 'CONT': 0x2,
>>- 'VARG': 0x3,
>>- 'LUAP': 0x4,
>>- 'CP': 0x5,
>>- 'PCALL': 0x6,
>>+ 'LUA': 0x0,
>>+ 'C': 0x1,
>>+ 'CONT': 0x2,
>>+ 'VARG': 0x3,
>>+ 'LUAP': 0x4,
>>+ 'CP': 0x5,
>>+ 'PCALL': 0x6,
>> 'PCALLH': 0x7,
>> }
>>
>> def frametypes(ft):
>> return {
>>- FRAME['LUA'] : 'L',
>>- FRAME['C'] : 'C',
>>- FRAME['CONT'] : 'M',
>>- FRAME['VARG'] : 'V',
>>+ FRAME['LUA']: 'L',
>>+ FRAME['C']: 'C',
>>+ FRAME['CONT']: 'M',
>>+ FRAME['VARG']: 'V',
>> }.get(ft, '?')
>>
>> def bc_a(ins):
>>@@ -299,12 +299,12 @@ def gcringlen(root):
>> return 1 + gclistlen(gcnext(root), gcref(root))
>>
>> gclen = {
>>- 'root': gclistlen,
>>- 'gray': gclistlen,
>>+ 'root': gclistlen,
>>+ 'gray': gclistlen,
>> 'grayagain': gclistlen,
>>- 'weak': gclistlen,
>>+ 'weak': gclistlen,
>> # XXX: gc.mmudata is a ring-list.
>>- 'mmudata': gcringlen,
>>+ 'mmudata': gcringlen,
>> }
>>
>> # The generator that implements frame iterator.
>>@@ -410,20 +410,20 @@ def dump_lj_invalid(tv):
>> # }}}
>>
>> dumpers = {
>>- 'LJ_TNIL': dump_lj_tnil,
>>- 'LJ_TFALSE': dump_lj_tfalse,
>>- 'LJ_TTRUE': dump_lj_ttrue,
>>+ 'LJ_TNIL': dump_lj_tnil,
>>+ 'LJ_TFALSE': dump_lj_tfalse,
>>+ 'LJ_TTRUE': dump_lj_ttrue,
>> 'LJ_TLIGHTUD': dump_lj_tlightud,
>>- 'LJ_TSTR': dump_lj_tstr,
>>- 'LJ_TUPVAL': dump_lj_tupval,
>>- 'LJ_TTHREAD': dump_lj_tthread,
>>- 'LJ_TPROTO': dump_lj_tproto,
>>- 'LJ_TFUNC': dump_lj_tfunc,
>>- 'LJ_TTRACE': dump_lj_ttrace,
>>- 'LJ_TCDATA': dump_lj_tcdata,
>>- 'LJ_TTAB': dump_lj_ttab,
>>- 'LJ_TUDATA': dump_lj_tudata,
>>- 'LJ_TNUMX': dump_lj_tnumx,
>>+ 'LJ_TSTR': dump_lj_tstr,
>>+ 'LJ_TUPVAL': dump_lj_tupval,
>>+ 'LJ_TTHREAD': dump_lj_tthread,
>>+ 'LJ_TPROTO': dump_lj_tproto,
>>+ 'LJ_TFUNC': dump_lj_tfunc,
>>+ 'LJ_TTRACE': dump_lj_ttrace,
>>+ 'LJ_TCDATA': dump_lj_tcdata,
>>+ 'LJ_TTAB': dump_lj_ttab,
>>+ 'LJ_TUDATA': dump_lj_tudata,
>>+ 'LJ_TNUMX': dump_lj_tnumx,
>> }
>>
>> def dump_tvalue(tvalue):
>>@@ -695,8 +695,8 @@ The command requires no args and dumps current VM and GC states
>> g = G(L(None))
>> gdb.write('{}\n'.format('\n'.join(
>> map(lambda t: '{} state: {}'.format(*t), {
>>- 'VM': vm_state(g),
>>- 'GC': gc_state(g),
>>+ 'VM': vm_state(g),
>>+ 'GC': gc_state(g),
>> 'JIT': jit_state(g),
>> }.items())
>> )))
>>@@ -785,13 +785,13 @@ def init(commands):
>>
>> def load(event=None):
>> init({
>>- 'lj-arch': LJDumpArch,
>>- 'lj-tv': LJDumpTValue,
>>- 'lj-str': LJDumpString,
>>- 'lj-tab': LJDumpTable,
>>+ 'lj-arch': LJDumpArch,
>>+ 'lj-tv': LJDumpTValue,
>>+ 'lj-str': LJDumpString,
>>+ 'lj-tab': LJDumpTable,
>> 'lj-stack': LJDumpStack,
>> 'lj-state': LJState,
>>- 'lj-gc': LJGC,
>>+ 'lj-gc': LJGC,
>> })
>>
>> load(None)
>>diff --git a/src/luajit_lldb.py b/src/luajit_lldb.py
>>index 2887723b..b9c8a0b9 100644
>>--- a/src/luajit_lldb.py
>>+++ b/src/luajit_lldb.py
>>@@ -88,8 +88,8 @@ class MetaStruct(type):
>>
>> def make_general(field, tp):
>> builtin = {
>>- 'uint': 'unsigned',
>>- 'int': 'signed',
>>+ 'uint': 'unsigned',
>>+ 'int': 'signed',
>> 'string': 'value',
>> }
>> if tp in builtin.keys():
>>@@ -380,12 +380,12 @@ def gcringlen(root):
>> return 1 + gclistlen(gcnext(root), gcref(root))
>>
>> gclen = {
>>- 'root': gclistlen,
>>- 'gray': gclistlen,
>>+ 'root': gclistlen,
>>+ 'gray': gclistlen,
>> 'grayagain': gclistlen,
>>- 'weak': gclistlen,
>>+ 'weak': gclistlen,
>> # XXX: gc.mmudata is a ring-list.
>>- 'mmudata': gcringlen,
>>+ 'mmudata': gcringlen,
>> }
>>
>> def dump_gc(g):
>>@@ -582,37 +582,37 @@ def dump_lj_invalid(tv):
>> return 'not valid type @ {}'.format(strx64(gcval(tv.gcr)))
>>
>> dumpers = {
>>- 'LJ_TNIL': dump_lj_tnil,
>>- 'LJ_TFALSE': dump_lj_tfalse,
>>- 'LJ_TTRUE': dump_lj_ttrue,
>>+ 'LJ_TNIL': dump_lj_tnil,
>>+ 'LJ_TFALSE': dump_lj_tfalse,
>>+ 'LJ_TTRUE': dump_lj_ttrue,
>> 'LJ_TLIGHTUD': dump_lj_tlightud,
>>- 'LJ_TSTR': dump_lj_tstr,
>>- 'LJ_TUPVAL': dump_lj_tupval,
>>- 'LJ_TTHREAD': dump_lj_tthread,
>>- 'LJ_TPROTO': dump_lj_tproto,
>>- 'LJ_TFUNC': dump_lj_tfunc,
>>- 'LJ_TTRACE': dump_lj_ttrace,
>>- 'LJ_TCDATA': dump_lj_tcdata,
>>- 'LJ_TTAB': dump_lj_ttab,
>>- 'LJ_TUDATA': dump_lj_tudata,
>>- 'LJ_TNUMX': dump_lj_tnumx,
>>+ 'LJ_TSTR': dump_lj_tstr,
>>+ 'LJ_TUPVAL': dump_lj_tupval,
>>+ 'LJ_TTHREAD': dump_lj_tthread,
>>+ 'LJ_TPROTO': dump_lj_tproto,
>>+ 'LJ_TFUNC': dump_lj_tfunc,
>>+ 'LJ_TTRACE': dump_lj_ttrace,
>>+ 'LJ_TCDATA': dump_lj_tcdata,
>>+ 'LJ_TTAB': dump_lj_ttab,
>>+ 'LJ_TUDATA': dump_lj_tudata,
>>+ 'LJ_TNUMX': dump_lj_tnumx,
>> }
>>
>> LJ_T = {
>>- 'NIL' : i2notu32(0),
>>- 'FALSE' : i2notu32(1),
>>- 'TRUE' : i2notu32(2),
>>- 'LIGHTUD' : i2notu32(3),
>>- 'STR' : i2notu32(4),
>>- 'UPVAL' : i2notu32(5),
>>- 'THREAD' : i2notu32(6),
>>- 'PROTO' : i2notu32(7),
>>- 'FUNC' : i2notu32(8),
>>- 'TRACE' : i2notu32(9),
>>- 'CDATA' : i2notu32(10),
>>- 'TAB' : i2notu32(11),
>>- 'UDATA' : i2notu32(12),
>>- 'NUMX' : i2notu32(13),
>>+ 'NIL': i2notu32(0),
>>+ 'FALSE': i2notu32(1),
>>+ 'TRUE': i2notu32(2),
>>+ 'LIGHTUD': i2notu32(3),
>>+ 'STR': i2notu32(4),
>>+ 'UPVAL': i2notu32(5),
>>+ 'THREAD': i2notu32(6),
>>+ 'PROTO': i2notu32(7),
>>+ 'FUNC': i2notu32(8),
>>+ 'TRACE': i2notu32(9),
>>+ 'CDATA': i2notu32(10),
>>+ 'TAB': i2notu32(11),
>>+ 'UDATA': i2notu32(12),
>>+ 'NUMX': i2notu32(13),
>> }
>>
>> def itypemap(o):
>>@@ -635,22 +635,22 @@ FRAME_P = 0x4
>> FRAME_TYPEP = FRAME_TYPE | FRAME_P
>>
>> FRAME = {
>>- 'LUA': 0x0,
>>- 'C': 0x1,
>>- 'CONT': 0x2,
>>- 'VARG': 0x3,
>>- 'LUAP': 0x4,
>>- 'CP': 0x5,
>>- 'PCALL': 0x6,
>>+ 'LUA': 0x0,
>>+ 'C': 0x1,
>>+ 'CONT': 0x2,
>>+ 'VARG': 0x3,
>>+ 'LUAP': 0x4,
>>+ 'CP': 0x5,
>>+ 'PCALL': 0x6,
>> 'PCALLH': 0x7,
>> }
>>
>> def frametypes(ft):
>> return {
>>- FRAME['LUA'] : 'L',
>>- FRAME['C'] : 'C',
>>- FRAME['CONT'] : 'M',
>>- FRAME['VARG'] : 'V',
>>+ FRAME['LUA']: 'L',
>>+ FRAME['C']: 'C',
>>+ FRAME['CONT']: 'M',
>>+ FRAME['VARG']: 'V',
>> }.get(ft, '?')
>>
>> def bc_a(ins):
>>@@ -838,8 +838,8 @@ The command requires no args and dumps current VM and GC states
>> g = G(L(None))
>> print('{}'.format('\n'.join(
>> map(lambda t: '{} state: {}'.format(*t), {
>>- 'VM': vm_state(g),
>>- 'GC': gc_state(g),
>>+ 'VM': vm_state(g),
>>+ 'GC': gc_state(g),
>> 'JIT': jit_state(g),
>> }.items())
>> )))
>>@@ -1024,12 +1024,12 @@ def configure(debugger):
>> def __lldb_init_module(debugger, internal_dict):
>> configure(debugger)
>> register_commands(debugger, {
>>- 'lj-tv': LJDumpTValue,
>>+ 'lj-tv': LJDumpTValue,
>> 'lj-state': LJState,
>>- 'lj-arch': LJDumpArch,
>>- 'lj-gc': LJGC,
>>- 'lj-str': LJDumpString,
>>- 'lj-tab': LJDumpTable,
>>+ 'lj-arch': LJDumpArch,
>>+ 'lj-gc': LJGC,
>>+ 'lj-str': LJDumpString,
>>+ 'lj-tab': LJDumpTable,
>> 'lj-stack': LJDumpStack,
>> })
>> print('luajit_lldb.py is successfully loaded')
>>--
>>2.30.2
>
[-- Attachment #2: Type: text/html, Size: 11804 bytes --]
^ permalink raw reply [flat|nested] 68+ messages in thread
* [Tarantool-patches] [PATCH luajit 05/15] test: fix E231 errors by pycodestyle
2023-08-03 7:30 [Tarantool-patches] [PATCH luajit 00/15] Add flake8 linter Igor Munkin via Tarantool-patches
` (3 preceding siblings ...)
2023-08-03 7:30 ` [Tarantool-patches] [PATCH luajit 04/15] test: fix E203 " Igor Munkin via Tarantool-patches
@ 2023-08-03 7:30 ` Igor Munkin via Tarantool-patches
2023-08-03 14:26 ` Sergey Bronnikov via Tarantool-patches
2023-08-03 15:55 ` Maxim Kokryashkin via Tarantool-patches
2023-08-03 7:30 ` [Tarantool-patches] [PATCH luajit 06/15] test: fix E251 " Igor Munkin via Tarantool-patches
` (10 subsequent siblings)
15 siblings, 2 replies; 68+ messages in thread
From: Igor Munkin via Tarantool-patches @ 2023-08-03 7:30 UTC (permalink / raw)
To: Maxim Kokryashkin, Sergey Bronnikov; +Cc: tarantool-patches
Fixed the only occurrence of E231 ("missing whitespace after ','") error
reported by pycodestyle[1].
[1]: https://www.flake8rules.com/rules/E231.html
Signed-off-by: Igor Munkin <imun@tarantool.org>
---
src/luajit_lldb.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/luajit_lldb.py b/src/luajit_lldb.py
index b9c8a0b9..a7a756e9 100644
--- a/src/luajit_lldb.py
+++ b/src/luajit_lldb.py
@@ -166,7 +166,7 @@ c_structs = {
('uint', 'state')
],
'GChead': [
- ('GCRef','nextgc')
+ ('GCRef', 'nextgc')
],
'GCobj': [
('GChead', 'gch')
--
2.30.2
^ permalink raw reply [flat|nested] 68+ messages in thread
* Re: [Tarantool-patches] [PATCH luajit 05/15] test: fix E231 errors by pycodestyle
2023-08-03 7:30 ` [Tarantool-patches] [PATCH luajit 05/15] test: fix E231 " Igor Munkin via Tarantool-patches
@ 2023-08-03 14:26 ` Sergey Bronnikov via Tarantool-patches
2023-08-03 15:55 ` Maxim Kokryashkin via Tarantool-patches
1 sibling, 0 replies; 68+ messages in thread
From: Sergey Bronnikov via Tarantool-patches @ 2023-08-03 14:26 UTC (permalink / raw)
To: Igor Munkin, Maxim Kokryashkin; +Cc: tarantool-patches
LGTM
On 8/3/23 10:30, Igor Munkin wrote:
> Fixed the only occurrence of E231 ("missing whitespace after ','") error
> reported by pycodestyle[1].
>
> [1]: https://www.flake8rules.com/rules/E231.html
>
> Signed-off-by: Igor Munkin <imun@tarantool.org>
> ---
> src/luajit_lldb.py | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/src/luajit_lldb.py b/src/luajit_lldb.py
> index b9c8a0b9..a7a756e9 100644
> --- a/src/luajit_lldb.py
> +++ b/src/luajit_lldb.py
> @@ -166,7 +166,7 @@ c_structs = {
> ('uint', 'state')
> ],
> 'GChead': [
> - ('GCRef','nextgc')
> + ('GCRef', 'nextgc')
> ],
> 'GCobj': [
> ('GChead', 'gch')
^ permalink raw reply [flat|nested] 68+ messages in thread
* Re: [Tarantool-patches] [PATCH luajit 05/15] test: fix E231 errors by pycodestyle
2023-08-03 7:30 ` [Tarantool-patches] [PATCH luajit 05/15] test: fix E231 " Igor Munkin via Tarantool-patches
2023-08-03 14:26 ` Sergey Bronnikov via Tarantool-patches
@ 2023-08-03 15:55 ` Maxim Kokryashkin via Tarantool-patches
1 sibling, 0 replies; 68+ messages in thread
From: Maxim Kokryashkin via Tarantool-patches @ 2023-08-03 15:55 UTC (permalink / raw)
To: Igor Munkin; +Cc: tarantool-patches
[-- Attachment #1: Type: text/plain, Size: 783 bytes --]
Hi, Igor!
Thanks for the patch!
LGTM
--
Best regards,
Maxim Kokryashkin
>
>>Fixed the only occurrence of E231 ("missing whitespace after ','") error
>>reported by pycodestyle[1].
>>
>>[1]: https://www.flake8rules.com/rules/E231.html
>>
>>Signed-off-by: Igor Munkin < imun@tarantool.org >
>>---
>> src/luajit_lldb.py | 2 +-
>> 1 file changed, 1 insertion(+), 1 deletion(-)
>>
>>diff --git a/src/luajit_lldb.py b/src/luajit_lldb.py
>>index b9c8a0b9..a7a756e9 100644
>>--- a/src/luajit_lldb.py
>>+++ b/src/luajit_lldb.py
>>@@ -166,7 +166,7 @@ c_structs = {
>> ('uint', 'state')
>> ],
>> 'GChead': [
>>- ('GCRef','nextgc')
>>+ ('GCRef', 'nextgc')
>> ],
>> 'GCobj': [
>> ('GChead', 'gch')
>>--
>>2.30.2
>
[-- Attachment #2: Type: text/html, Size: 1623 bytes --]
^ permalink raw reply [flat|nested] 68+ messages in thread
* [Tarantool-patches] [PATCH luajit 06/15] test: fix E251 errors by pycodestyle
2023-08-03 7:30 [Tarantool-patches] [PATCH luajit 00/15] Add flake8 linter Igor Munkin via Tarantool-patches
` (4 preceding siblings ...)
2023-08-03 7:30 ` [Tarantool-patches] [PATCH luajit 05/15] test: fix E231 " Igor Munkin via Tarantool-patches
@ 2023-08-03 7:30 ` Igor Munkin via Tarantool-patches
2023-08-03 14:27 ` Sergey Bronnikov via Tarantool-patches
2023-08-03 15:58 ` Maxim Kokryashkin via Tarantool-patches
2023-08-03 7:30 ` [Tarantool-patches] [PATCH luajit 07/15] test: fix E301 " Igor Munkin via Tarantool-patches
` (9 subsequent siblings)
15 siblings, 2 replies; 68+ messages in thread
From: Igor Munkin via Tarantool-patches @ 2023-08-03 7:30 UTC (permalink / raw)
To: Maxim Kokryashkin, Sergey Bronnikov; +Cc: tarantool-patches
Fixed 208 occurrences of E251 ("unexpected spaces around keyword /
parameter equals") error reported by pycodestyle[1].
[1]: https://www.flake8rules.com/rules/E251.html
Signed-off-by: Igor Munkin <imun@tarantool.org>
---
src/luajit-gdb.py | 102 ++++++++++++++++++++++----------------------
src/luajit_lldb.py | 104 ++++++++++++++++++++++-----------------------
2 files changed, 103 insertions(+), 103 deletions(-)
diff --git a/src/luajit-gdb.py b/src/luajit-gdb.py
index 09899f58..f87063f8 100644
--- a/src/luajit-gdb.py
+++ b/src/luajit-gdb.py
@@ -347,8 +347,8 @@ def dump_lj_tlightud(tv):
def dump_lj_tstr(tv):
return 'string {body} @ {address}'.format(
- body = strdata(gcval(tv['gcr'])),
- address = strx64(gcval(tv['gcr']))
+ body=strdata(gcval(tv['gcr'])),
+ address=strx64(gcval(tv['gcr']))
)
def dump_lj_tupval(tv):
@@ -367,10 +367,10 @@ def dump_lj_tfunc(tv):
if ffid == 0:
pt = funcproto(func)
return 'Lua function @ {addr}, {nupvals} upvalues, {chunk}:{line}'.format(
- addr = strx64(func),
- nupvals = int(func['nupvalues']),
- chunk = strdata(cast('GCstr *', gcval(pt['chunkname']))),
- line = pt['firstline']
+ addr=strx64(func),
+ nupvals=int(func['nupvalues']),
+ chunk=strdata(cast('GCstr *', gcval(pt['chunkname']))),
+ line=pt['firstline']
)
elif ffid == 1:
return 'C function @ {}'.format(strx64(func['f']))
@@ -380,8 +380,8 @@ def dump_lj_tfunc(tv):
def dump_lj_ttrace(tv):
trace = cast('struct GCtrace *', gcval(tv['gcr']))
return 'trace {traceno} @ {addr}'.format(
- traceno = strx64(trace['traceno']),
- addr = strx64(trace)
+ traceno=strx64(trace['traceno']),
+ addr=strx64(trace)
)
def dump_lj_tcdata(tv):
@@ -390,9 +390,9 @@ def dump_lj_tcdata(tv):
def dump_lj_ttab(tv):
table = cast('GCtab *', gcval(tv['gcr']))
return 'table @ {gcr} (asize: {asize}, hmask: {hmask})'.format(
- gcr = strx64(table),
- asize = table['asize'],
- hmask = strx64(table['hmask']),
+ gcr=strx64(table),
+ asize=table['asize'],
+ hmask=strx64(table['hmask']),
)
def dump_lj_tudata(tv):
@@ -436,16 +436,16 @@ def dump_framelink_slot_address(fr):
def dump_framelink(L, fr):
if fr == frame_sentinel(L):
return '{addr} [S ] FRAME: dummy L'.format(
- addr = dump_framelink_slot_address(fr),
+ addr=dump_framelink_slot_address(fr),
)
return '{addr} [ ] FRAME: [{pp}] delta={d}, {f}'.format(
- addr = dump_framelink_slot_address(fr),
- pp = 'PP' if frame_ispcall(fr) else '{frname}{p}'.format(
- frname = frametypes(int(frame_type(fr))),
- p = 'P' if frame_typep(fr) & FRAME_P else ''
+ addr=dump_framelink_slot_address(fr),
+ pp='PP' if frame_ispcall(fr) else '{frname}{p}'.format(
+ frname=frametypes(int(frame_type(fr))),
+ p='P' if frame_typep(fr) & FRAME_P else ''
),
- d = cast('TValue *', fr) - cast('TValue *', frame_prev(fr)),
- f = dump_lj_tfunc(fr - LJ_FR2),
+ d=cast('TValue *', fr) - cast('TValue *', frame_prev(fr)),
+ f=dump_lj_tfunc(fr - LJ_FR2),
)
def dump_stack_slot(L, slot, base=None, top=None):
@@ -453,12 +453,12 @@ def dump_stack_slot(L, slot, base=None, top=None):
top = top or L['top']
return '{addr}{padding} [ {B}{T}{M}] VALUE: {value}'.format(
- addr = strx64(slot),
- padding = PADDING,
- B = 'B' if slot == base else ' ',
- T = 'T' if slot == top else ' ',
- M = 'M' if slot == mref('TValue *', L['maxstack']) else ' ',
- value = dump_tvalue(slot),
+ addr=strx64(slot),
+ padding=PADDING,
+ B='B' if slot == base else ' ',
+ T='T' if slot == top else ' ',
+ M='M' if slot == mref('TValue *', L['maxstack']) else ' ',
+ value=dump_tvalue(slot),
)
def dump_stack(L, base=None, top=None):
@@ -470,8 +470,8 @@ def dump_stack(L, base=None, top=None):
dump = [
'{padding} Red zone: {nredslots: >2} slots {padding}'.format(
- padding = '-' * len(PADDING),
- nredslots = red,
+ padding='-' * len(PADDING),
+ nredslots=red,
),
]
dump.extend([
@@ -480,14 +480,14 @@ def dump_stack(L, base=None, top=None):
])
dump.extend([
'{padding} Stack: {nstackslots: >5} slots {padding}'.format(
- padding = '-' * len(PADDING),
- nstackslots = int((tou64(maxstack) - tou64(stack)) >> 3),
+ padding='-' * len(PADDING),
+ nstackslots=int((tou64(maxstack) - tou64(stack)) >> 3),
),
dump_stack_slot(L, maxstack, base, top),
'{start}:{end} [ ] {nfreeslots} slots: Free stack slots'.format(
- start = strx64(top + 1),
- end = strx64(maxstack - 1),
- nfreeslots = int((tou64(maxstack) - tou64(top) - 8) >> 3),
+ start=strx64(top + 1),
+ end=strx64(maxstack - 1),
+ nfreeslots=int((tou64(maxstack) - tou64(top) - 8) >> 3),
),
])
@@ -504,19 +504,19 @@ def dump_stack(L, base=None, top=None):
def dump_gc(g):
gc = g['gc']
- stats = ['{key}: {value}'.format(key = f, value = gc[f]) for f in (
+ stats = ['{key}: {value}'.format(key=f, value=gc[f]) for f in (
'total', 'threshold', 'debt', 'estimate', 'stepmul', 'pause'
)]
stats += ['sweepstr: {sweepstr}/{strmask}'.format(
- sweepstr = gc['sweepstr'],
+ sweepstr=gc['sweepstr'],
# String hash mask (size of hash table - 1).
- strmask = g['strmask'] + 1,
+ strmask=g['strmask'] + 1,
)]
stats += ['{key}: {number} objects'.format(
- key = stat,
- number = handler(gc[stat])
+ key=stat,
+ number=handler(gc[stat])
) for stat, handler in gclen.items()]
return '\n'.join(map(lambda s: '\t' + s, stats))
@@ -543,9 +543,9 @@ pointers respectively.
gdb.write(
'LJ_64: {LJ_64}, LJ_GC64: {LJ_GC64}, LJ_DUALNUM: {LJ_DUALNUM}\n'
.format(
- LJ_64 = LJ_64,
- LJ_GC64 = LJ_GC64,
- LJ_DUALNUM = LJ_DUALNUM
+ LJ_64=LJ_64,
+ LJ_GC64=LJ_GC64,
+ LJ_DUALNUM=LJ_DUALNUM
)
)
@@ -596,9 +596,9 @@ is replaced with the corresponding error when decoding fails.
def invoke(self, arg, from_tty):
string = cast('GCstr *', parse_arg(arg))
gdb.write("String: {body} [{len} bytes] with hash {hash}\n".format(
- body = strdata(string),
- hash = strx64(string['hash']),
- len = string['len'],
+ body=strdata(string),
+ hash=strx64(string['hash']),
+ len=string['len'],
))
class LJDumpTable(LJBase):
@@ -630,9 +630,9 @@ The command receives a GCtab adress and dumps the table contents:
for i in range(capacity['apart']):
slot = array + i
gdb.write('{ptr}: [{index}]: {value}\n'.format(
- ptr = slot,
- index = i,
- value = dump_tvalue(slot)
+ ptr=slot,
+ index=i,
+ value=dump_tvalue(slot)
))
gdb.write('Hash part: {} nodes\n'.format(capacity['hpart']))
@@ -640,10 +640,10 @@ The command receives a GCtab adress and dumps the table contents:
for i in range(capacity['hpart']):
node = nodes + i
gdb.write('{ptr}: {{ {key} }} => {{ {val} }}; next = {n}\n'.format(
- ptr = node,
- key = dump_tvalue(node['key']),
- val= dump_tvalue(node['val']),
- n = mref('struct Node *', node['next'])
+ ptr=node,
+ key=dump_tvalue(node['key']),
+ val=dump_tvalue(node['val']),
+ n=mref('struct Node *', node['next'])
))
class LJDumpStack(LJBase):
@@ -723,8 +723,8 @@ The command requires no args and dumps current GC stats:
def invoke(self, arg, from_tty):
g = G(L(None))
gdb.write('GC stats: {state}\n{stats}\n'.format(
- state = gc_state(g),
- stats = dump_gc(g)
+ state=gc_state(g),
+ stats=dump_gc(g)
))
def init(commands):
diff --git a/src/luajit_lldb.py b/src/luajit_lldb.py
index a7a756e9..f502a0e6 100644
--- a/src/luajit_lldb.py
+++ b/src/luajit_lldb.py
@@ -390,19 +390,19 @@ gclen = {
def dump_gc(g):
gc = g.gc
- stats = ['{key}: {value}'.format(key = f, value = getattr(gc, f)) for f in (
+ stats = ['{key}: {value}'.format(key=f, value=getattr(gc, f)) for f in (
'total', 'threshold', 'debt', 'estimate', 'stepmul', 'pause'
)]
stats += ['sweepstr: {sweepstr}/{strmask}'.format(
- sweepstr = gc.sweepstr,
+ sweepstr=gc.sweepstr,
# String hash mask (size of hash table - 1).
- strmask = g.strmask + 1,
+ strmask=g.strmask + 1,
)]
stats += ['{key}: {number} objects'.format(
- key = stat,
- number = handler(getattr(gc, stat))
+ key=stat,
+ number=handler(getattr(gc, stat))
) for stat, handler in gclen.items()]
return '\n'.join(map(lambda s: '\t' + s, stats))
@@ -521,8 +521,8 @@ def dump_lj_tlightud(tv):
def dump_lj_tstr(tv):
return 'string {body} @ {address}'.format(
- body = strdata(cast(GCstrPtr, gcval(tv.gcr))),
- address = strx64(gcval(tv.gcr))
+ body=strdata(cast(GCstrPtr, gcval(tv.gcr))),
+ address=strx64(gcval(tv.gcr))
)
def dump_lj_tupval(tv):
@@ -541,10 +541,10 @@ def dump_lj_tfunc(tv):
if ffid == 0:
pt = funcproto(func)
return 'Lua function @ {addr}, {nupvals} upvalues, {chunk}:{line}'.format(
- addr = strx64(func),
- nupvals = func.nupvalues,
- chunk = strdata(cast(GCstrPtr, gcval(pt.chunkname))),
- line = pt.firstline
+ addr=strx64(func),
+ nupvals=func.nupvalues,
+ chunk=strdata(cast(GCstrPtr, gcval(pt.chunkname))),
+ line=pt.firstline
)
elif ffid == 1:
return 'C function @ {}'.format(strx64(func.f))
@@ -554,8 +554,8 @@ def dump_lj_tfunc(tv):
def dump_lj_ttrace(tv):
trace = cast(GCtracePtr, gcval(tv.gcr))
return 'trace {traceno} @ {addr}'.format(
- traceno = strx64(trace.traceno),
- addr = strx64(trace)
+ traceno=strx64(trace.traceno),
+ addr=strx64(trace)
)
def dump_lj_tcdata(tv):
@@ -564,9 +564,9 @@ def dump_lj_tcdata(tv):
def dump_lj_ttab(tv):
table = cast(GCtabPtr, gcval(tv.gcr))
return 'table @ {gcr} (asize: {asize}, hmask: {hmask})'.format(
- gcr = strx64(table),
- asize = table.asize,
- hmask = strx64(table.hmask),
+ gcr=strx64(table),
+ asize=table.asize,
+ hmask=strx64(table.hmask),
)
def dump_lj_tudata(tv):
@@ -724,16 +724,16 @@ def dump_framelink_slot_address(fr):
def dump_framelink(L, fr):
if fr == frame_sentinel(L):
return '{addr} [S ] FRAME: dummy L'.format(
- addr = dump_framelink_slot_address(fr),
+ addr=dump_framelink_slot_address(fr),
)
return '{addr} [ ] FRAME: [{pp}] delta={d}, {f}'.format(
- addr = dump_framelink_slot_address(fr),
- pp = 'PP' if frame_ispcall(fr) else '{frname}{p}'.format(
- frname = frametypes(int(frame_type(fr))),
- p = 'P' if frame_typep(fr) & FRAME_P else ''
+ addr=dump_framelink_slot_address(fr),
+ pp='PP' if frame_ispcall(fr) else '{frname}{p}'.format(
+ frname=frametypes(int(frame_type(fr))),
+ p='P' if frame_typep(fr) & FRAME_P else ''
),
- d = fr - frame_prev(fr),
- f = dump_lj_tfunc(fr - LJ_FR2),
+ d=fr - frame_prev(fr),
+ f=dump_lj_tfunc(fr - LJ_FR2),
)
def dump_stack_slot(L, slot, base=None, top=None):
@@ -741,12 +741,12 @@ def dump_stack_slot(L, slot, base=None, top=None):
top = top or L.top
return '{addr:{padding}} [ {B}{T}{M}] VALUE: {value}'.format(
- addr = strx64(slot),
- padding = 2 * len(PADDING) + 1,
- B = 'B' if slot == base else ' ',
- T = 'T' if slot == top else ' ',
- M = 'M' if slot == mref(TValuePtr, L.maxstack) else ' ',
- value = dump_tvalue(slot),
+ addr=strx64(slot),
+ padding=2 * len(PADDING) + 1,
+ B='B' if slot == base else ' ',
+ T='T' if slot == top else ' ',
+ M='M' if slot == mref(TValuePtr, L.maxstack) else ' ',
+ value=dump_tvalue(slot),
)
def dump_stack(L, base=None, top=None):
@@ -758,8 +758,8 @@ def dump_stack(L, base=None, top=None):
dump = [
'{padding} Red zone: {nredslots: >2} slots {padding}'.format(
- padding = '-' * len(PADDING),
- nredslots = red,
+ padding='-' * len(PADDING),
+ nredslots=red,
),
]
dump.extend([
@@ -768,15 +768,15 @@ def dump_stack(L, base=None, top=None):
])
dump.extend([
'{padding} Stack: {nstackslots: >5} slots {padding}'.format(
- padding = '-' * len(PADDING),
- nstackslots = int((maxstack - stack) >> 3),
+ padding='-' * len(PADDING),
+ nstackslots=int((maxstack - stack) >> 3),
),
dump_stack_slot(L, maxstack, base, top),
'{start:{padding}}:{end:{padding}} [ ] {nfreeslots} slots: Free stack slots'.format(
- start = strx64(top + 1),
- end = strx64(maxstack - 1),
- padding = len(PADDING),
- nfreeslots = int((maxstack - top - 8) >> 3),
+ start=strx64(top + 1),
+ end=strx64(maxstack - 1),
+ padding=len(PADDING),
+ nfreeslots=int((maxstack - top - 8) >> 3),
),
])
@@ -856,9 +856,9 @@ pointers respectively.
print(
'LJ_64: {LJ_64}, LJ_GC64: {LJ_GC64}, LJ_DUALNUM: {LJ_DUALNUM}'
.format(
- LJ_64 = LJ_64,
- LJ_GC64 = LJ_GC64,
- LJ_DUALNUM = LJ_DUALNUM
+ LJ_64=LJ_64,
+ LJ_GC64=LJ_GC64,
+ LJ_DUALNUM=LJ_DUALNUM
)
)
@@ -883,8 +883,8 @@ The command requires no args and dumps current GC stats:
def execute(self, debugger, args, result):
g = G(L(None))
print('GC stats: {state}\n{stats}'.format(
- state = gc_state(g),
- stats = dump_gc(g)
+ state=gc_state(g),
+ stats=dump_gc(g)
))
class LJDumpString(Command):
@@ -900,9 +900,9 @@ is replaced with the corresponding error when decoding fails.
def execute(self, debugger, args, result):
string_ptr = GCstrPtr(cast('GCstr *', self.parse(args)))
print("String: {body} [{len} bytes] with hash {hash}".format(
- body = strdata(string_ptr),
- hash = strx64(string_ptr.hash),
- len = string_ptr.len,
+ body=strdata(string_ptr),
+ hash=strx64(string_ptr.hash),
+ len=string_ptr.len,
))
class LJDumpTable(Command):
@@ -933,9 +933,9 @@ The command receives a GCtab adress and dumps the table contents:
for i in range(capacity['apart']):
slot = array + i
print('{ptr}: [{index}]: {value}'.format(
- ptr = strx64(slot),
- index = i,
- value = dump_tvalue(slot)
+ ptr=strx64(slot),
+ index=i,
+ value=dump_tvalue(slot)
))
print('Hash part: {} nodes'.format(capacity['hpart']))
@@ -943,10 +943,10 @@ The command receives a GCtab adress and dumps the table contents:
for i in range(capacity['hpart']):
node = nodes + i
print('{ptr}: {{ {key} }} => {{ {val} }}; next = {n}'.format(
- ptr = strx64(node),
- key = dump_tvalue(TValuePtr(node.key.addr)),
- val= dump_tvalue(TValuePtr(node.val.addr)),
- n = strx64(mref(NodePtr, node.next))
+ ptr=strx64(node),
+ key=dump_tvalue(TValuePtr(node.key.addr)),
+ val=dump_tvalue(TValuePtr(node.val.addr)),
+ n=strx64(mref(NodePtr, node.next))
))
class LJDumpStack(Command):
--
2.30.2
^ permalink raw reply [flat|nested] 68+ messages in thread
* Re: [Tarantool-patches] [PATCH luajit 06/15] test: fix E251 errors by pycodestyle
2023-08-03 7:30 ` [Tarantool-patches] [PATCH luajit 06/15] test: fix E251 " Igor Munkin via Tarantool-patches
@ 2023-08-03 14:27 ` Sergey Bronnikov via Tarantool-patches
2023-08-03 15:58 ` Maxim Kokryashkin via Tarantool-patches
1 sibling, 0 replies; 68+ messages in thread
From: Sergey Bronnikov via Tarantool-patches @ 2023-08-03 14:27 UTC (permalink / raw)
To: Igor Munkin, Maxim Kokryashkin; +Cc: tarantool-patches
LGTM
On 8/3/23 10:30, Igor Munkin wrote:
> Fixed 208 occurrences of E251 ("unexpected spaces around keyword /
> parameter equals") error reported by pycodestyle[1].
>
> [1]: https://www.flake8rules.com/rules/E251.html
>
> Signed-off-by: Igor Munkin <imun@tarantool.org>
> ---
> src/luajit-gdb.py | 102 ++++++++++++++++++++++----------------------
> src/luajit_lldb.py | 104 ++++++++++++++++++++++-----------------------
> 2 files changed, 103 insertions(+), 103 deletions(-)
>
> diff --git a/src/luajit-gdb.py b/src/luajit-gdb.py
> index 09899f58..f87063f8 100644
> --- a/src/luajit-gdb.py
> +++ b/src/luajit-gdb.py
> @@ -347,8 +347,8 @@ def dump_lj_tlightud(tv):
>
> def dump_lj_tstr(tv):
> return 'string {body} @ {address}'.format(
> - body = strdata(gcval(tv['gcr'])),
> - address = strx64(gcval(tv['gcr']))
> + body=strdata(gcval(tv['gcr'])),
> + address=strx64(gcval(tv['gcr']))
> )
>
> def dump_lj_tupval(tv):
> @@ -367,10 +367,10 @@ def dump_lj_tfunc(tv):
> if ffid == 0:
> pt = funcproto(func)
> return 'Lua function @ {addr}, {nupvals} upvalues, {chunk}:{line}'.format(
> - addr = strx64(func),
> - nupvals = int(func['nupvalues']),
> - chunk = strdata(cast('GCstr *', gcval(pt['chunkname']))),
> - line = pt['firstline']
> + addr=strx64(func),
> + nupvals=int(func['nupvalues']),
> + chunk=strdata(cast('GCstr *', gcval(pt['chunkname']))),
> + line=pt['firstline']
> )
> elif ffid == 1:
> return 'C function @ {}'.format(strx64(func['f']))
> @@ -380,8 +380,8 @@ def dump_lj_tfunc(tv):
> def dump_lj_ttrace(tv):
> trace = cast('struct GCtrace *', gcval(tv['gcr']))
> return 'trace {traceno} @ {addr}'.format(
> - traceno = strx64(trace['traceno']),
> - addr = strx64(trace)
> + traceno=strx64(trace['traceno']),
> + addr=strx64(trace)
> )
>
> def dump_lj_tcdata(tv):
> @@ -390,9 +390,9 @@ def dump_lj_tcdata(tv):
> def dump_lj_ttab(tv):
> table = cast('GCtab *', gcval(tv['gcr']))
> return 'table @ {gcr} (asize: {asize}, hmask: {hmask})'.format(
> - gcr = strx64(table),
> - asize = table['asize'],
> - hmask = strx64(table['hmask']),
> + gcr=strx64(table),
> + asize=table['asize'],
> + hmask=strx64(table['hmask']),
> )
>
> def dump_lj_tudata(tv):
> @@ -436,16 +436,16 @@ def dump_framelink_slot_address(fr):
> def dump_framelink(L, fr):
> if fr == frame_sentinel(L):
> return '{addr} [S ] FRAME: dummy L'.format(
> - addr = dump_framelink_slot_address(fr),
> + addr=dump_framelink_slot_address(fr),
> )
> return '{addr} [ ] FRAME: [{pp}] delta={d}, {f}'.format(
> - addr = dump_framelink_slot_address(fr),
> - pp = 'PP' if frame_ispcall(fr) else '{frname}{p}'.format(
> - frname = frametypes(int(frame_type(fr))),
> - p = 'P' if frame_typep(fr) & FRAME_P else ''
> + addr=dump_framelink_slot_address(fr),
> + pp='PP' if frame_ispcall(fr) else '{frname}{p}'.format(
> + frname=frametypes(int(frame_type(fr))),
> + p='P' if frame_typep(fr) & FRAME_P else ''
> ),
> - d = cast('TValue *', fr) - cast('TValue *', frame_prev(fr)),
> - f = dump_lj_tfunc(fr - LJ_FR2),
> + d=cast('TValue *', fr) - cast('TValue *', frame_prev(fr)),
> + f=dump_lj_tfunc(fr - LJ_FR2),
> )
>
> def dump_stack_slot(L, slot, base=None, top=None):
> @@ -453,12 +453,12 @@ def dump_stack_slot(L, slot, base=None, top=None):
> top = top or L['top']
>
> return '{addr}{padding} [ {B}{T}{M}] VALUE: {value}'.format(
> - addr = strx64(slot),
> - padding = PADDING,
> - B = 'B' if slot == base else ' ',
> - T = 'T' if slot == top else ' ',
> - M = 'M' if slot == mref('TValue *', L['maxstack']) else ' ',
> - value = dump_tvalue(slot),
> + addr=strx64(slot),
> + padding=PADDING,
> + B='B' if slot == base else ' ',
> + T='T' if slot == top else ' ',
> + M='M' if slot == mref('TValue *', L['maxstack']) else ' ',
> + value=dump_tvalue(slot),
> )
>
> def dump_stack(L, base=None, top=None):
> @@ -470,8 +470,8 @@ def dump_stack(L, base=None, top=None):
>
> dump = [
> '{padding} Red zone: {nredslots: >2} slots {padding}'.format(
> - padding = '-' * len(PADDING),
> - nredslots = red,
> + padding='-' * len(PADDING),
> + nredslots=red,
> ),
> ]
> dump.extend([
> @@ -480,14 +480,14 @@ def dump_stack(L, base=None, top=None):
> ])
> dump.extend([
> '{padding} Stack: {nstackslots: >5} slots {padding}'.format(
> - padding = '-' * len(PADDING),
> - nstackslots = int((tou64(maxstack) - tou64(stack)) >> 3),
> + padding='-' * len(PADDING),
> + nstackslots=int((tou64(maxstack) - tou64(stack)) >> 3),
> ),
> dump_stack_slot(L, maxstack, base, top),
> '{start}:{end} [ ] {nfreeslots} slots: Free stack slots'.format(
> - start = strx64(top + 1),
> - end = strx64(maxstack - 1),
> - nfreeslots = int((tou64(maxstack) - tou64(top) - 8) >> 3),
> + start=strx64(top + 1),
> + end=strx64(maxstack - 1),
> + nfreeslots=int((tou64(maxstack) - tou64(top) - 8) >> 3),
> ),
> ])
>
> @@ -504,19 +504,19 @@ def dump_stack(L, base=None, top=None):
>
> def dump_gc(g):
> gc = g['gc']
> - stats = ['{key}: {value}'.format(key = f, value = gc[f]) for f in (
> + stats = ['{key}: {value}'.format(key=f, value=gc[f]) for f in (
> 'total', 'threshold', 'debt', 'estimate', 'stepmul', 'pause'
> )]
>
> stats += ['sweepstr: {sweepstr}/{strmask}'.format(
> - sweepstr = gc['sweepstr'],
> + sweepstr=gc['sweepstr'],
> # String hash mask (size of hash table - 1).
> - strmask = g['strmask'] + 1,
> + strmask=g['strmask'] + 1,
> )]
>
> stats += ['{key}: {number} objects'.format(
> - key = stat,
> - number = handler(gc[stat])
> + key=stat,
> + number=handler(gc[stat])
> ) for stat, handler in gclen.items()]
>
> return '\n'.join(map(lambda s: '\t' + s, stats))
> @@ -543,9 +543,9 @@ pointers respectively.
> gdb.write(
> 'LJ_64: {LJ_64}, LJ_GC64: {LJ_GC64}, LJ_DUALNUM: {LJ_DUALNUM}\n'
> .format(
> - LJ_64 = LJ_64,
> - LJ_GC64 = LJ_GC64,
> - LJ_DUALNUM = LJ_DUALNUM
> + LJ_64=LJ_64,
> + LJ_GC64=LJ_GC64,
> + LJ_DUALNUM=LJ_DUALNUM
> )
> )
>
> @@ -596,9 +596,9 @@ is replaced with the corresponding error when decoding fails.
> def invoke(self, arg, from_tty):
> string = cast('GCstr *', parse_arg(arg))
> gdb.write("String: {body} [{len} bytes] with hash {hash}\n".format(
> - body = strdata(string),
> - hash = strx64(string['hash']),
> - len = string['len'],
> + body=strdata(string),
> + hash=strx64(string['hash']),
> + len=string['len'],
> ))
>
> class LJDumpTable(LJBase):
> @@ -630,9 +630,9 @@ The command receives a GCtab adress and dumps the table contents:
> for i in range(capacity['apart']):
> slot = array + i
> gdb.write('{ptr}: [{index}]: {value}\n'.format(
> - ptr = slot,
> - index = i,
> - value = dump_tvalue(slot)
> + ptr=slot,
> + index=i,
> + value=dump_tvalue(slot)
> ))
>
> gdb.write('Hash part: {} nodes\n'.format(capacity['hpart']))
> @@ -640,10 +640,10 @@ The command receives a GCtab adress and dumps the table contents:
> for i in range(capacity['hpart']):
> node = nodes + i
> gdb.write('{ptr}: {{ {key} }} => {{ {val} }}; next = {n}\n'.format(
> - ptr = node,
> - key = dump_tvalue(node['key']),
> - val= dump_tvalue(node['val']),
> - n = mref('struct Node *', node['next'])
> + ptr=node,
> + key=dump_tvalue(node['key']),
> + val=dump_tvalue(node['val']),
> + n=mref('struct Node *', node['next'])
> ))
>
> class LJDumpStack(LJBase):
> @@ -723,8 +723,8 @@ The command requires no args and dumps current GC stats:
> def invoke(self, arg, from_tty):
> g = G(L(None))
> gdb.write('GC stats: {state}\n{stats}\n'.format(
> - state = gc_state(g),
> - stats = dump_gc(g)
> + state=gc_state(g),
> + stats=dump_gc(g)
> ))
>
> def init(commands):
> diff --git a/src/luajit_lldb.py b/src/luajit_lldb.py
> index a7a756e9..f502a0e6 100644
> --- a/src/luajit_lldb.py
> +++ b/src/luajit_lldb.py
> @@ -390,19 +390,19 @@ gclen = {
>
> def dump_gc(g):
> gc = g.gc
> - stats = ['{key}: {value}'.format(key = f, value = getattr(gc, f)) for f in (
> + stats = ['{key}: {value}'.format(key=f, value=getattr(gc, f)) for f in (
> 'total', 'threshold', 'debt', 'estimate', 'stepmul', 'pause'
> )]
>
> stats += ['sweepstr: {sweepstr}/{strmask}'.format(
> - sweepstr = gc.sweepstr,
> + sweepstr=gc.sweepstr,
> # String hash mask (size of hash table - 1).
> - strmask = g.strmask + 1,
> + strmask=g.strmask + 1,
> )]
>
> stats += ['{key}: {number} objects'.format(
> - key = stat,
> - number = handler(getattr(gc, stat))
> + key=stat,
> + number=handler(getattr(gc, stat))
> ) for stat, handler in gclen.items()]
> return '\n'.join(map(lambda s: '\t' + s, stats))
>
> @@ -521,8 +521,8 @@ def dump_lj_tlightud(tv):
>
> def dump_lj_tstr(tv):
> return 'string {body} @ {address}'.format(
> - body = strdata(cast(GCstrPtr, gcval(tv.gcr))),
> - address = strx64(gcval(tv.gcr))
> + body=strdata(cast(GCstrPtr, gcval(tv.gcr))),
> + address=strx64(gcval(tv.gcr))
> )
>
> def dump_lj_tupval(tv):
> @@ -541,10 +541,10 @@ def dump_lj_tfunc(tv):
> if ffid == 0:
> pt = funcproto(func)
> return 'Lua function @ {addr}, {nupvals} upvalues, {chunk}:{line}'.format(
> - addr = strx64(func),
> - nupvals = func.nupvalues,
> - chunk = strdata(cast(GCstrPtr, gcval(pt.chunkname))),
> - line = pt.firstline
> + addr=strx64(func),
> + nupvals=func.nupvalues,
> + chunk=strdata(cast(GCstrPtr, gcval(pt.chunkname))),
> + line=pt.firstline
> )
> elif ffid == 1:
> return 'C function @ {}'.format(strx64(func.f))
> @@ -554,8 +554,8 @@ def dump_lj_tfunc(tv):
> def dump_lj_ttrace(tv):
> trace = cast(GCtracePtr, gcval(tv.gcr))
> return 'trace {traceno} @ {addr}'.format(
> - traceno = strx64(trace.traceno),
> - addr = strx64(trace)
> + traceno=strx64(trace.traceno),
> + addr=strx64(trace)
> )
>
> def dump_lj_tcdata(tv):
> @@ -564,9 +564,9 @@ def dump_lj_tcdata(tv):
> def dump_lj_ttab(tv):
> table = cast(GCtabPtr, gcval(tv.gcr))
> return 'table @ {gcr} (asize: {asize}, hmask: {hmask})'.format(
> - gcr = strx64(table),
> - asize = table.asize,
> - hmask = strx64(table.hmask),
> + gcr=strx64(table),
> + asize=table.asize,
> + hmask=strx64(table.hmask),
> )
>
> def dump_lj_tudata(tv):
> @@ -724,16 +724,16 @@ def dump_framelink_slot_address(fr):
> def dump_framelink(L, fr):
> if fr == frame_sentinel(L):
> return '{addr} [S ] FRAME: dummy L'.format(
> - addr = dump_framelink_slot_address(fr),
> + addr=dump_framelink_slot_address(fr),
> )
> return '{addr} [ ] FRAME: [{pp}] delta={d}, {f}'.format(
> - addr = dump_framelink_slot_address(fr),
> - pp = 'PP' if frame_ispcall(fr) else '{frname}{p}'.format(
> - frname = frametypes(int(frame_type(fr))),
> - p = 'P' if frame_typep(fr) & FRAME_P else ''
> + addr=dump_framelink_slot_address(fr),
> + pp='PP' if frame_ispcall(fr) else '{frname}{p}'.format(
> + frname=frametypes(int(frame_type(fr))),
> + p='P' if frame_typep(fr) & FRAME_P else ''
> ),
> - d = fr - frame_prev(fr),
> - f = dump_lj_tfunc(fr - LJ_FR2),
> + d=fr - frame_prev(fr),
> + f=dump_lj_tfunc(fr - LJ_FR2),
> )
>
> def dump_stack_slot(L, slot, base=None, top=None):
> @@ -741,12 +741,12 @@ def dump_stack_slot(L, slot, base=None, top=None):
> top = top or L.top
>
> return '{addr:{padding}} [ {B}{T}{M}] VALUE: {value}'.format(
> - addr = strx64(slot),
> - padding = 2 * len(PADDING) + 1,
> - B = 'B' if slot == base else ' ',
> - T = 'T' if slot == top else ' ',
> - M = 'M' if slot == mref(TValuePtr, L.maxstack) else ' ',
> - value = dump_tvalue(slot),
> + addr=strx64(slot),
> + padding=2 * len(PADDING) + 1,
> + B='B' if slot == base else ' ',
> + T='T' if slot == top else ' ',
> + M='M' if slot == mref(TValuePtr, L.maxstack) else ' ',
> + value=dump_tvalue(slot),
> )
>
> def dump_stack(L, base=None, top=None):
> @@ -758,8 +758,8 @@ def dump_stack(L, base=None, top=None):
>
> dump = [
> '{padding} Red zone: {nredslots: >2} slots {padding}'.format(
> - padding = '-' * len(PADDING),
> - nredslots = red,
> + padding='-' * len(PADDING),
> + nredslots=red,
> ),
> ]
> dump.extend([
> @@ -768,15 +768,15 @@ def dump_stack(L, base=None, top=None):
> ])
> dump.extend([
> '{padding} Stack: {nstackslots: >5} slots {padding}'.format(
> - padding = '-' * len(PADDING),
> - nstackslots = int((maxstack - stack) >> 3),
> + padding='-' * len(PADDING),
> + nstackslots=int((maxstack - stack) >> 3),
> ),
> dump_stack_slot(L, maxstack, base, top),
> '{start:{padding}}:{end:{padding}} [ ] {nfreeslots} slots: Free stack slots'.format(
> - start = strx64(top + 1),
> - end = strx64(maxstack - 1),
> - padding = len(PADDING),
> - nfreeslots = int((maxstack - top - 8) >> 3),
> + start=strx64(top + 1),
> + end=strx64(maxstack - 1),
> + padding=len(PADDING),
> + nfreeslots=int((maxstack - top - 8) >> 3),
> ),
> ])
>
> @@ -856,9 +856,9 @@ pointers respectively.
> print(
> 'LJ_64: {LJ_64}, LJ_GC64: {LJ_GC64}, LJ_DUALNUM: {LJ_DUALNUM}'
> .format(
> - LJ_64 = LJ_64,
> - LJ_GC64 = LJ_GC64,
> - LJ_DUALNUM = LJ_DUALNUM
> + LJ_64=LJ_64,
> + LJ_GC64=LJ_GC64,
> + LJ_DUALNUM=LJ_DUALNUM
> )
> )
>
> @@ -883,8 +883,8 @@ The command requires no args and dumps current GC stats:
> def execute(self, debugger, args, result):
> g = G(L(None))
> print('GC stats: {state}\n{stats}'.format(
> - state = gc_state(g),
> - stats = dump_gc(g)
> + state=gc_state(g),
> + stats=dump_gc(g)
> ))
>
> class LJDumpString(Command):
> @@ -900,9 +900,9 @@ is replaced with the corresponding error when decoding fails.
> def execute(self, debugger, args, result):
> string_ptr = GCstrPtr(cast('GCstr *', self.parse(args)))
> print("String: {body} [{len} bytes] with hash {hash}".format(
> - body = strdata(string_ptr),
> - hash = strx64(string_ptr.hash),
> - len = string_ptr.len,
> + body=strdata(string_ptr),
> + hash=strx64(string_ptr.hash),
> + len=string_ptr.len,
> ))
>
> class LJDumpTable(Command):
> @@ -933,9 +933,9 @@ The command receives a GCtab adress and dumps the table contents:
> for i in range(capacity['apart']):
> slot = array + i
> print('{ptr}: [{index}]: {value}'.format(
> - ptr = strx64(slot),
> - index = i,
> - value = dump_tvalue(slot)
> + ptr=strx64(slot),
> + index=i,
> + value=dump_tvalue(slot)
> ))
>
> print('Hash part: {} nodes'.format(capacity['hpart']))
> @@ -943,10 +943,10 @@ The command receives a GCtab adress and dumps the table contents:
> for i in range(capacity['hpart']):
> node = nodes + i
> print('{ptr}: {{ {key} }} => {{ {val} }}; next = {n}'.format(
> - ptr = strx64(node),
> - key = dump_tvalue(TValuePtr(node.key.addr)),
> - val= dump_tvalue(TValuePtr(node.val.addr)),
> - n = strx64(mref(NodePtr, node.next))
> + ptr=strx64(node),
> + key=dump_tvalue(TValuePtr(node.key.addr)),
> + val=dump_tvalue(TValuePtr(node.val.addr)),
> + n=strx64(mref(NodePtr, node.next))
> ))
>
> class LJDumpStack(Command):
^ permalink raw reply [flat|nested] 68+ messages in thread
* Re: [Tarantool-patches] [PATCH luajit 06/15] test: fix E251 errors by pycodestyle
2023-08-03 7:30 ` [Tarantool-patches] [PATCH luajit 06/15] test: fix E251 " Igor Munkin via Tarantool-patches
2023-08-03 14:27 ` Sergey Bronnikov via Tarantool-patches
@ 2023-08-03 15:58 ` Maxim Kokryashkin via Tarantool-patches
1 sibling, 0 replies; 68+ messages in thread
From: Maxim Kokryashkin via Tarantool-patches @ 2023-08-03 15:58 UTC (permalink / raw)
To: Igor Munkin; +Cc: tarantool-patches
[-- Attachment #1: Type: text/plain, Size: 16666 bytes --]
Hi, Igor!
Thanks for the patch!
LGTM
--
Best regards,
Maxim Kokryashkin
>
>>Fixed 208 occurrences of E251 ("unexpected spaces around keyword /
>>parameter equals") error reported by pycodestyle[1].
>>
>>[1]: https://www.flake8rules.com/rules/E251.html
>>
>>Signed-off-by: Igor Munkin < imun@tarantool.org >
>>---
>> src/luajit-gdb.py | 102 ++++++++++++++++++++++----------------------
>> src/luajit_lldb.py | 104 ++++++++++++++++++++++-----------------------
>> 2 files changed, 103 insertions(+), 103 deletions(-)
>>
>>diff --git a/src/luajit-gdb.py b/src/luajit-gdb.py
>>index 09899f58..f87063f8 100644
>>--- a/src/luajit-gdb.py
>>+++ b/src/luajit-gdb.py
>>@@ -347,8 +347,8 @@ def dump_lj_tlightud(tv):
>>
>> def dump_lj_tstr(tv):
>> return 'string {body} @ {address}'.format(
>>- body = strdata(gcval(tv['gcr'])),
>>- address = strx64(gcval(tv['gcr']))
>>+ body=strdata(gcval(tv['gcr'])),
>>+ address=strx64(gcval(tv['gcr']))
>> )
>>
>> def dump_lj_tupval(tv):
>>@@ -367,10 +367,10 @@ def dump_lj_tfunc(tv):
>> if ffid == 0:
>> pt = funcproto(func)
>> return 'Lua function @ {addr}, {nupvals} upvalues, {chunk}:{line}'.format(
>>- addr = strx64(func),
>>- nupvals = int(func['nupvalues']),
>>- chunk = strdata(cast('GCstr *', gcval(pt['chunkname']))),
>>- line = pt['firstline']
>>+ addr=strx64(func),
>>+ nupvals=int(func['nupvalues']),
>>+ chunk=strdata(cast('GCstr *', gcval(pt['chunkname']))),
>>+ line=pt['firstline']
>> )
>> elif ffid == 1:
>> return 'C function @ {}'.format(strx64(func['f']))
>>@@ -380,8 +380,8 @@ def dump_lj_tfunc(tv):
>> def dump_lj_ttrace(tv):
>> trace = cast('struct GCtrace *', gcval(tv['gcr']))
>> return 'trace {traceno} @ {addr}'.format(
>>- traceno = strx64(trace['traceno']),
>>- addr = strx64(trace)
>>+ traceno=strx64(trace['traceno']),
>>+ addr=strx64(trace)
>> )
>>
>> def dump_lj_tcdata(tv):
>>@@ -390,9 +390,9 @@ def dump_lj_tcdata(tv):
>> def dump_lj_ttab(tv):
>> table = cast('GCtab *', gcval(tv['gcr']))
>> return 'table @ {gcr} (asize: {asize}, hmask: {hmask})'.format(
>>- gcr = strx64(table),
>>- asize = table['asize'],
>>- hmask = strx64(table['hmask']),
>>+ gcr=strx64(table),
>>+ asize=table['asize'],
>>+ hmask=strx64(table['hmask']),
>> )
>>
>> def dump_lj_tudata(tv):
>>@@ -436,16 +436,16 @@ def dump_framelink_slot_address(fr):
>> def dump_framelink(L, fr):
>> if fr == frame_sentinel(L):
>> return '{addr} [S ] FRAME: dummy L'.format(
>>- addr = dump_framelink_slot_address(fr),
>>+ addr=dump_framelink_slot_address(fr),
>> )
>> return '{addr} [ ] FRAME: [{pp}] delta={d}, {f}'.format(
>>- addr = dump_framelink_slot_address(fr),
>>- pp = 'PP' if frame_ispcall(fr) else '{frname}{p}'.format(
>>- frname = frametypes(int(frame_type(fr))),
>>- p = 'P' if frame_typep(fr) & FRAME_P else ''
>>+ addr=dump_framelink_slot_address(fr),
>>+ pp='PP' if frame_ispcall(fr) else '{frname}{p}'.format(
>>+ frname=frametypes(int(frame_type(fr))),
>>+ p='P' if frame_typep(fr) & FRAME_P else ''
>> ),
>>- d = cast('TValue *', fr) - cast('TValue *', frame_prev(fr)),
>>- f = dump_lj_tfunc(fr - LJ_FR2),
>>+ d=cast('TValue *', fr) - cast('TValue *', frame_prev(fr)),
>>+ f=dump_lj_tfunc(fr - LJ_FR2),
>> )
>>
>> def dump_stack_slot(L, slot, base=None, top=None):
>>@@ -453,12 +453,12 @@ def dump_stack_slot(L, slot, base=None, top=None):
>> top = top or L['top']
>>
>> return '{addr}{padding} [ {B}{T}{M}] VALUE: {value}'.format(
>>- addr = strx64(slot),
>>- padding = PADDING,
>>- B = 'B' if slot == base else ' ',
>>- T = 'T' if slot == top else ' ',
>>- M = 'M' if slot == mref('TValue *', L['maxstack']) else ' ',
>>- value = dump_tvalue(slot),
>>+ addr=strx64(slot),
>>+ padding=PADDING,
>>+ B='B' if slot == base else ' ',
>>+ T='T' if slot == top else ' ',
>>+ M='M' if slot == mref('TValue *', L['maxstack']) else ' ',
>>+ value=dump_tvalue(slot),
>> )
>>
>> def dump_stack(L, base=None, top=None):
>>@@ -470,8 +470,8 @@ def dump_stack(L, base=None, top=None):
>>
>> dump = [
>> '{padding} Red zone: {nredslots: >2} slots {padding}'.format(
>>- padding = '-' * len(PADDING),
>>- nredslots = red,
>>+ padding='-' * len(PADDING),
>>+ nredslots=red,
>> ),
>> ]
>> dump.extend([
>>@@ -480,14 +480,14 @@ def dump_stack(L, base=None, top=None):
>> ])
>> dump.extend([
>> '{padding} Stack: {nstackslots: >5} slots {padding}'.format(
>>- padding = '-' * len(PADDING),
>>- nstackslots = int((tou64(maxstack) - tou64(stack)) >> 3),
>>+ padding='-' * len(PADDING),
>>+ nstackslots=int((tou64(maxstack) - tou64(stack)) >> 3),
>> ),
>> dump_stack_slot(L, maxstack, base, top),
>> '{start}:{end} [ ] {nfreeslots} slots: Free stack slots'.format(
>>- start = strx64(top + 1),
>>- end = strx64(maxstack - 1),
>>- nfreeslots = int((tou64(maxstack) - tou64(top) - 8) >> 3),
>>+ start=strx64(top + 1),
>>+ end=strx64(maxstack - 1),
>>+ nfreeslots=int((tou64(maxstack) - tou64(top) - 8) >> 3),
>> ),
>> ])
>>
>>@@ -504,19 +504,19 @@ def dump_stack(L, base=None, top=None):
>>
>> def dump_gc(g):
>> gc = g['gc']
>>- stats = ['{key}: {value}'.format(key = f, value = gc[f]) for f in (
>>+ stats = ['{key}: {value}'.format(key=f, value=gc[f]) for f in (
>> 'total', 'threshold', 'debt', 'estimate', 'stepmul', 'pause'
>> )]
>>
>> stats += ['sweepstr: {sweepstr}/{strmask}'.format(
>>- sweepstr = gc['sweepstr'],
>>+ sweepstr=gc['sweepstr'],
>> # String hash mask (size of hash table - 1).
>>- strmask = g['strmask'] + 1,
>>+ strmask=g['strmask'] + 1,
>> )]
>>
>> stats += ['{key}: {number} objects'.format(
>>- key = stat,
>>- number = handler(gc[stat])
>>+ key=stat,
>>+ number=handler(gc[stat])
>> ) for stat, handler in gclen.items()]
>>
>> return '\n'.join(map(lambda s: '\t' + s, stats))
>>@@ -543,9 +543,9 @@ pointers respectively.
>> gdb.write(
>> 'LJ_64: {LJ_64}, LJ_GC64: {LJ_GC64}, LJ_DUALNUM: {LJ_DUALNUM}\n'
>> .format(
>>- LJ_64 = LJ_64,
>>- LJ_GC64 = LJ_GC64,
>>- LJ_DUALNUM = LJ_DUALNUM
>>+ LJ_64=LJ_64,
>>+ LJ_GC64=LJ_GC64,
>>+ LJ_DUALNUM=LJ_DUALNUM
>> )
>> )
>>
>>@@ -596,9 +596,9 @@ is replaced with the corresponding error when decoding fails.
>> def invoke(self, arg, from_tty):
>> string = cast('GCstr *', parse_arg(arg))
>> gdb.write("String: {body} [{len} bytes] with hash {hash}\n".format(
>>- body = strdata(string),
>>- hash = strx64(string['hash']),
>>- len = string['len'],
>>+ body=strdata(string),
>>+ hash=strx64(string['hash']),
>>+ len=string['len'],
>> ))
>>
>> class LJDumpTable(LJBase):
>>@@ -630,9 +630,9 @@ The command receives a GCtab adress and dumps the table contents:
>> for i in range(capacity['apart']):
>> slot = array + i
>> gdb.write('{ptr}: [{index}]: {value}\n'.format(
>>- ptr = slot,
>>- index = i,
>>- value = dump_tvalue(slot)
>>+ ptr=slot,
>>+ index=i,
>>+ value=dump_tvalue(slot)
>> ))
>>
>> gdb.write('Hash part: {} nodes\n'.format(capacity['hpart']))
>>@@ -640,10 +640,10 @@ The command receives a GCtab adress and dumps the table contents:
>> for i in range(capacity['hpart']):
>> node = nodes + i
>> gdb.write('{ptr}: {{ {key} }} => {{ {val} }}; next = {n}\n'.format(
>>- ptr = node,
>>- key = dump_tvalue(node['key']),
>>- val= dump_tvalue(node['val']),
>>- n = mref('struct Node *', node['next'])
>>+ ptr=node,
>>+ key=dump_tvalue(node['key']),
>>+ val=dump_tvalue(node['val']),
>>+ n=mref('struct Node *', node['next'])
>> ))
>>
>> class LJDumpStack(LJBase):
>>@@ -723,8 +723,8 @@ The command requires no args and dumps current GC stats:
>> def invoke(self, arg, from_tty):
>> g = G(L(None))
>> gdb.write('GC stats: {state}\n{stats}\n'.format(
>>- state = gc_state(g),
>>- stats = dump_gc(g)
>>+ state=gc_state(g),
>>+ stats=dump_gc(g)
>> ))
>>
>> def init(commands):
>>diff --git a/src/luajit_lldb.py b/src/luajit_lldb.py
>>index a7a756e9..f502a0e6 100644
>>--- a/src/luajit_lldb.py
>>+++ b/src/luajit_lldb.py
>>@@ -390,19 +390,19 @@ gclen = {
>>
>> def dump_gc(g):
>> gc = g.gc
>>- stats = ['{key}: {value}'.format(key = f, value = getattr(gc, f)) for f in (
>>+ stats = ['{key}: {value}'.format(key=f, value=getattr(gc, f)) for f in (
>> 'total', 'threshold', 'debt', 'estimate', 'stepmul', 'pause'
>> )]
>>
>> stats += ['sweepstr: {sweepstr}/{strmask}'.format(
>>- sweepstr = gc.sweepstr,
>>+ sweepstr=gc.sweepstr,
>> # String hash mask (size of hash table - 1).
>>- strmask = g.strmask + 1,
>>+ strmask=g.strmask + 1,
>> )]
>>
>> stats += ['{key}: {number} objects'.format(
>>- key = stat,
>>- number = handler(getattr(gc, stat))
>>+ key=stat,
>>+ number=handler(getattr(gc, stat))
>> ) for stat, handler in gclen.items()]
>> return '\n'.join(map(lambda s: '\t' + s, stats))
>>
>>@@ -521,8 +521,8 @@ def dump_lj_tlightud(tv):
>>
>> def dump_lj_tstr(tv):
>> return 'string {body} @ {address}'.format(
>>- body = strdata(cast(GCstrPtr, gcval(tv.gcr))),
>>- address = strx64(gcval(tv.gcr))
>>+ body=strdata(cast(GCstrPtr, gcval(tv.gcr))),
>>+ address=strx64(gcval(tv.gcr))
>> )
>>
>> def dump_lj_tupval(tv):
>>@@ -541,10 +541,10 @@ def dump_lj_tfunc(tv):
>> if ffid == 0:
>> pt = funcproto(func)
>> return 'Lua function @ {addr}, {nupvals} upvalues, {chunk}:{line}'.format(
>>- addr = strx64(func),
>>- nupvals = func.nupvalues,
>>- chunk = strdata(cast(GCstrPtr, gcval(pt.chunkname))),
>>- line = pt.firstline
>>+ addr=strx64(func),
>>+ nupvals=func.nupvalues,
>>+ chunk=strdata(cast(GCstrPtr, gcval(pt.chunkname))),
>>+ line=pt.firstline
>> )
>> elif ffid == 1:
>> return 'C function @ {}'.format(strx64(func.f))
>>@@ -554,8 +554,8 @@ def dump_lj_tfunc(tv):
>> def dump_lj_ttrace(tv):
>> trace = cast(GCtracePtr, gcval(tv.gcr))
>> return 'trace {traceno} @ {addr}'.format(
>>- traceno = strx64(trace.traceno),
>>- addr = strx64(trace)
>>+ traceno=strx64(trace.traceno),
>>+ addr=strx64(trace)
>> )
>>
>> def dump_lj_tcdata(tv):
>>@@ -564,9 +564,9 @@ def dump_lj_tcdata(tv):
>> def dump_lj_ttab(tv):
>> table = cast(GCtabPtr, gcval(tv.gcr))
>> return 'table @ {gcr} (asize: {asize}, hmask: {hmask})'.format(
>>- gcr = strx64(table),
>>- asize = table.asize,
>>- hmask = strx64(table.hmask),
>>+ gcr=strx64(table),
>>+ asize=table.asize,
>>+ hmask=strx64(table.hmask),
>> )
>>
>> def dump_lj_tudata(tv):
>>@@ -724,16 +724,16 @@ def dump_framelink_slot_address(fr):
>> def dump_framelink(L, fr):
>> if fr == frame_sentinel(L):
>> return '{addr} [S ] FRAME: dummy L'.format(
>>- addr = dump_framelink_slot_address(fr),
>>+ addr=dump_framelink_slot_address(fr),
>> )
>> return '{addr} [ ] FRAME: [{pp}] delta={d}, {f}'.format(
>>- addr = dump_framelink_slot_address(fr),
>>- pp = 'PP' if frame_ispcall(fr) else '{frname}{p}'.format(
>>- frname = frametypes(int(frame_type(fr))),
>>- p = 'P' if frame_typep(fr) & FRAME_P else ''
>>+ addr=dump_framelink_slot_address(fr),
>>+ pp='PP' if frame_ispcall(fr) else '{frname}{p}'.format(
>>+ frname=frametypes(int(frame_type(fr))),
>>+ p='P' if frame_typep(fr) & FRAME_P else ''
>> ),
>>- d = fr - frame_prev(fr),
>>- f = dump_lj_tfunc(fr - LJ_FR2),
>>+ d=fr - frame_prev(fr),
>>+ f=dump_lj_tfunc(fr - LJ_FR2),
>> )
>>
>> def dump_stack_slot(L, slot, base=None, top=None):
>>@@ -741,12 +741,12 @@ def dump_stack_slot(L, slot, base=None, top=None):
>> top = top or L.top
>>
>> return '{addr:{padding}} [ {B}{T}{M}] VALUE: {value}'.format(
>>- addr = strx64(slot),
>>- padding = 2 * len(PADDING) + 1,
>>- B = 'B' if slot == base else ' ',
>>- T = 'T' if slot == top else ' ',
>>- M = 'M' if slot == mref(TValuePtr, L.maxstack) else ' ',
>>- value = dump_tvalue(slot),
>>+ addr=strx64(slot),
>>+ padding=2 * len(PADDING) + 1,
>>+ B='B' if slot == base else ' ',
>>+ T='T' if slot == top else ' ',
>>+ M='M' if slot == mref(TValuePtr, L.maxstack) else ' ',
>>+ value=dump_tvalue(slot),
>> )
>>
>> def dump_stack(L, base=None, top=None):
>>@@ -758,8 +758,8 @@ def dump_stack(L, base=None, top=None):
>>
>> dump = [
>> '{padding} Red zone: {nredslots: >2} slots {padding}'.format(
>>- padding = '-' * len(PADDING),
>>- nredslots = red,
>>+ padding='-' * len(PADDING),
>>+ nredslots=red,
>> ),
>> ]
>> dump.extend([
>>@@ -768,15 +768,15 @@ def dump_stack(L, base=None, top=None):
>> ])
>> dump.extend([
>> '{padding} Stack: {nstackslots: >5} slots {padding}'.format(
>>- padding = '-' * len(PADDING),
>>- nstackslots = int((maxstack - stack) >> 3),
>>+ padding='-' * len(PADDING),
>>+ nstackslots=int((maxstack - stack) >> 3),
>> ),
>> dump_stack_slot(L, maxstack, base, top),
>> '{start:{padding}}:{end:{padding}} [ ] {nfreeslots} slots: Free stack slots'.format(
>>- start = strx64(top + 1),
>>- end = strx64(maxstack - 1),
>>- padding = len(PADDING),
>>- nfreeslots = int((maxstack - top - 8) >> 3),
>>+ start=strx64(top + 1),
>>+ end=strx64(maxstack - 1),
>>+ padding=len(PADDING),
>>+ nfreeslots=int((maxstack - top - 8) >> 3),
>> ),
>> ])
>>
>>@@ -856,9 +856,9 @@ pointers respectively.
>> print(
>> 'LJ_64: {LJ_64}, LJ_GC64: {LJ_GC64}, LJ_DUALNUM: {LJ_DUALNUM}'
>> .format(
>>- LJ_64 = LJ_64,
>>- LJ_GC64 = LJ_GC64,
>>- LJ_DUALNUM = LJ_DUALNUM
>>+ LJ_64=LJ_64,
>>+ LJ_GC64=LJ_GC64,
>>+ LJ_DUALNUM=LJ_DUALNUM
>> )
>> )
>>
>>@@ -883,8 +883,8 @@ The command requires no args and dumps current GC stats:
>> def execute(self, debugger, args, result):
>> g = G(L(None))
>> print('GC stats: {state}\n{stats}'.format(
>>- state = gc_state(g),
>>- stats = dump_gc(g)
>>+ state=gc_state(g),
>>+ stats=dump_gc(g)
>> ))
>>
>> class LJDumpString(Command):
>>@@ -900,9 +900,9 @@ is replaced with the corresponding error when decoding fails.
>> def execute(self, debugger, args, result):
>> string_ptr = GCstrPtr(cast('GCstr *', self.parse(args)))
>> print("String: {body} [{len} bytes] with hash {hash}".format(
>>- body = strdata(string_ptr),
>>- hash = strx64(string_ptr.hash),
>>- len = string_ptr.len,
>>+ body=strdata(string_ptr),
>>+ hash=strx64(string_ptr.hash),
>>+ len=string_ptr.len,
>> ))
>>
>> class LJDumpTable(Command):
>>@@ -933,9 +933,9 @@ The command receives a GCtab adress and dumps the table contents:
>> for i in range(capacity['apart']):
>> slot = array + i
>> print('{ptr}: [{index}]: {value}'.format(
>>- ptr = strx64(slot),
>>- index = i,
>>- value = dump_tvalue(slot)
>>+ ptr=strx64(slot),
>>+ index=i,
>>+ value=dump_tvalue(slot)
>> ))
>>
>> print('Hash part: {} nodes'.format(capacity['hpart']))
>>@@ -943,10 +943,10 @@ The command receives a GCtab adress and dumps the table contents:
>> for i in range(capacity['hpart']):
>> node = nodes + i
>> print('{ptr}: {{ {key} }} => {{ {val} }}; next = {n}'.format(
>>- ptr = strx64(node),
>>- key = dump_tvalue(TValuePtr(node.key.addr)),
>>- val= dump_tvalue(TValuePtr(node.val.addr)),
>>- n = strx64(mref(NodePtr, node.next))
>>+ ptr=strx64(node),
>>+ key=dump_tvalue(TValuePtr(node.key.addr)),
>>+ val=dump_tvalue(TValuePtr(node.val.addr)),
>>+ n=strx64(mref(NodePtr, node.next))
>> ))
>>
>> class LJDumpStack(Command):
>>--
>>2.30.2
>
[-- Attachment #2: Type: text/html, Size: 22234 bytes --]
^ permalink raw reply [flat|nested] 68+ messages in thread
* [Tarantool-patches] [PATCH luajit 07/15] test: fix E301 errors by pycodestyle
2023-08-03 7:30 [Tarantool-patches] [PATCH luajit 00/15] Add flake8 linter Igor Munkin via Tarantool-patches
` (5 preceding siblings ...)
2023-08-03 7:30 ` [Tarantool-patches] [PATCH luajit 06/15] test: fix E251 " Igor Munkin via Tarantool-patches
@ 2023-08-03 7:30 ` Igor Munkin via Tarantool-patches
2023-08-03 14:28 ` Sergey Bronnikov via Tarantool-patches
2023-08-03 16:01 ` Maxim Kokryashkin via Tarantool-patches
2023-08-03 7:30 ` [Tarantool-patches] [PATCH luajit 08/15] test: fix E302 " Igor Munkin via Tarantool-patches
` (8 subsequent siblings)
15 siblings, 2 replies; 68+ messages in thread
From: Igor Munkin via Tarantool-patches @ 2023-08-03 7:30 UTC (permalink / raw)
To: Maxim Kokryashkin, Sergey Bronnikov; +Cc: tarantool-patches
Fixed the only occurrence of E301 ("expected 1 blank line, found 0")
error reported by pycodestyle[1].
[1]: https://www.flake8rules.com/rules/E301.html
Signed-off-by: Igor Munkin <imun@tarantool.org>
---
src/luajit_lldb.py | 1 +
1 file changed, 1 insertion(+)
diff --git a/src/luajit_lldb.py b/src/luajit_lldb.py
index f502a0e6..b62705c3 100644
--- a/src/luajit_lldb.py
+++ b/src/luajit_lldb.py
@@ -215,6 +215,7 @@ for cls in c_structs.keys():
for cls in Struct.__subclasses__():
ptr_name = cls.__name__ + 'Ptr'
+
def make_ptr_init(nm, cls):
return type(
nm,
--
2.30.2
^ permalink raw reply [flat|nested] 68+ messages in thread
* Re: [Tarantool-patches] [PATCH luajit 07/15] test: fix E301 errors by pycodestyle
2023-08-03 7:30 ` [Tarantool-patches] [PATCH luajit 07/15] test: fix E301 " Igor Munkin via Tarantool-patches
@ 2023-08-03 14:28 ` Sergey Bronnikov via Tarantool-patches
2023-08-03 16:01 ` Maxim Kokryashkin via Tarantool-patches
1 sibling, 0 replies; 68+ messages in thread
From: Sergey Bronnikov via Tarantool-patches @ 2023-08-03 14:28 UTC (permalink / raw)
To: Igor Munkin, Maxim Kokryashkin; +Cc: tarantool-patches
LGTM
On 8/3/23 10:30, Igor Munkin wrote:
> Fixed the only occurrence of E301 ("expected 1 blank line, found 0")
> error reported by pycodestyle[1].
>
> [1]: https://www.flake8rules.com/rules/E301.html
>
> Signed-off-by: Igor Munkin <imun@tarantool.org>
> ---
> src/luajit_lldb.py | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/src/luajit_lldb.py b/src/luajit_lldb.py
> index f502a0e6..b62705c3 100644
> --- a/src/luajit_lldb.py
> +++ b/src/luajit_lldb.py
> @@ -215,6 +215,7 @@ for cls in c_structs.keys():
>
> for cls in Struct.__subclasses__():
> ptr_name = cls.__name__ + 'Ptr'
> +
> def make_ptr_init(nm, cls):
> return type(
> nm,
^ permalink raw reply [flat|nested] 68+ messages in thread
* Re: [Tarantool-patches] [PATCH luajit 07/15] test: fix E301 errors by pycodestyle
2023-08-03 7:30 ` [Tarantool-patches] [PATCH luajit 07/15] test: fix E301 " Igor Munkin via Tarantool-patches
2023-08-03 14:28 ` Sergey Bronnikov via Tarantool-patches
@ 2023-08-03 16:01 ` Maxim Kokryashkin via Tarantool-patches
1 sibling, 0 replies; 68+ messages in thread
From: Maxim Kokryashkin via Tarantool-patches @ 2023-08-03 16:01 UTC (permalink / raw)
To: Igor Munkin; +Cc: tarantool-patches
[-- Attachment #1: Type: text/plain, Size: 793 bytes --]
Hi, Igor!
Thanks for the patch!
LGTM
--
Best regards,
Maxim Kokryashkin
>
>>Fixed the only occurrence of E301 ("expected 1 blank line, found 0")
>>error reported by pycodestyle[1].
>>
>>[1]: https://www.flake8rules.com/rules/E301.html
>>
>>Signed-off-by: Igor Munkin < imun@tarantool.org >
>>---
>> src/luajit_lldb.py | 1 +
>> 1 file changed, 1 insertion(+)
>>
>>diff --git a/src/luajit_lldb.py b/src/luajit_lldb.py
>>index f502a0e6..b62705c3 100644
>>--- a/src/luajit_lldb.py
>>+++ b/src/luajit_lldb.py
>>@@ -215,6 +215,7 @@ for cls in c_structs.keys():
>>
>> for cls in Struct.__subclasses__():
>> ptr_name = cls.__name__ + 'Ptr'
>>+
>> def make_ptr_init(nm, cls):
>> return type(
>> nm,
>>--
>>2.30.2
>
[-- Attachment #2: Type: text/html, Size: 1646 bytes --]
^ permalink raw reply [flat|nested] 68+ messages in thread
* [Tarantool-patches] [PATCH luajit 08/15] test: fix E302 errors by pycodestyle
2023-08-03 7:30 [Tarantool-patches] [PATCH luajit 00/15] Add flake8 linter Igor Munkin via Tarantool-patches
` (6 preceding siblings ...)
2023-08-03 7:30 ` [Tarantool-patches] [PATCH luajit 07/15] test: fix E301 " Igor Munkin via Tarantool-patches
@ 2023-08-03 7:30 ` Igor Munkin via Tarantool-patches
2023-08-03 14:28 ` Sergey Bronnikov via Tarantool-patches
2023-08-03 16:02 ` Maxim Kokryashkin via Tarantool-patches
2023-08-03 7:30 ` [Tarantool-patches] [PATCH luajit 09/15] test: fix E303 " Igor Munkin via Tarantool-patches
` (7 subsequent siblings)
15 siblings, 2 replies; 68+ messages in thread
From: Igor Munkin via Tarantool-patches @ 2023-08-03 7:30 UTC (permalink / raw)
To: Maxim Kokryashkin, Sergey Bronnikov; +Cc: tarantool-patches
Fixed 149 occurrences of E302 ("expected 2 blank lines, found 1") error
reported by pycodestyle[1].
[1]: https://www.flake8rules.com/rules/E302.html
Signed-off-by: Igor Munkin <imun@tarantool.org>
---
src/luajit-gdb.py | 73 ++++++++++++++++++++++++++++++++++++++++++++
src/luajit_lldb.py | 76 ++++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 149 insertions(+)
diff --git a/src/luajit-gdb.py b/src/luajit-gdb.py
index f87063f8..9c51be0b 100644
--- a/src/luajit-gdb.py
+++ b/src/luajit-gdb.py
@@ -18,6 +18,7 @@ if LEGACY:
gtype_cache = {}
+
def gtype(typestr):
global gtype_cache
if typestr in gtype_cache:
@@ -31,13 +32,16 @@ def gtype(typestr):
gtype_cache[typestr] = gtype
return gtype
+
def cast(typestr, val):
return gdb.Value(val).cast(gtype(typestr))
+
def lookup(symbol):
variable, _ = gdb.lookup_symbol(symbol)
return variable.value() if variable else None
+
def parse_arg(arg):
if not arg:
return None
@@ -49,15 +53,19 @@ def parse_arg(arg):
return ret
+
def tou64(val):
return cast('uint64_t', val) & 0xFFFFFFFFFFFFFFFF
+
def tou32(val):
return cast('uint32_t', val) & 0xFFFFFFFF
+
def i2notu32(val):
return ~int(val) & 0xFFFFFFFF
+
def strx64(val):
return re.sub('L?$', '',
hex(int(cast('uint64_t', val) & 0xFFFFFFFFFFFFFFFF)))
@@ -81,6 +89,7 @@ LJ_T = {
'NUMX': i2notu32(13),
}
+
def typenames(value):
return {
LJ_T[k]: 'LJ_T' + k for k in LJ_T.keys()
@@ -105,6 +114,7 @@ FRAME = {
'PCALLH': 0x7,
}
+
def frametypes(ft):
return {
FRAME['LUA']: 'L',
@@ -113,43 +123,55 @@ def frametypes(ft):
FRAME['VARG']: 'V',
}.get(ft, '?')
+
def bc_a(ins):
return (ins >> 8) & 0xff
+
def frame_ftsz(framelink):
return cast('ptrdiff_t', framelink['ftsz'] if LJ_FR2 \
else framelink['fr']['tp']['ftsz'])
+
def frame_pc(framelink):
return cast('BCIns *', frame_ftsz(framelink)) if LJ_FR2 \
else mref('BCIns *', framelink['fr']['tp']['pcr'])
+
def frame_prevl(framelink):
return framelink - (1 + LJ_FR2 + bc_a(frame_pc(framelink)[-1]))
+
def frame_ispcall(framelink):
return (frame_ftsz(framelink) & FRAME['PCALL']) == FRAME['PCALL']
+
def frame_sized(framelink):
return (frame_ftsz(framelink) & ~FRAME_TYPEP)
+
def frame_prevd(framelink):
return cast('TValue *', cast('char *', framelink) - frame_sized(framelink))
+
def frame_type(framelink):
return frame_ftsz(framelink) & FRAME_TYPE
+
def frame_typep(framelink):
return frame_ftsz(framelink) & FRAME_TYPEP
+
def frame_islua(framelink):
return frametypes(int(frame_type(framelink))) == 'L' \
and int(frame_ftsz(framelink)) > 0
+
def frame_prev(framelink):
return frame_prevl(framelink) if frame_islua(framelink) \
else frame_prevd(framelink)
+
def frame_sentinel(L):
return mref('TValue *', L['stack']) + LJ_FR2
@@ -174,23 +196,29 @@ LIGHTUD_LO_MASK = (1 << LJ_LIGHTUD_BITS_LO) - 1
# }}}
+
def itype(o):
return cast('uint32_t', o['it64'] >> 47) if LJ_GC64 else o['it']
+
def mref(typename, obj):
return cast(typename, obj['ptr64'] if LJ_GC64 else obj['ptr32'])
+
def gcref(obj):
return cast('GCobj *', obj['gcptr64'] if LJ_GC64
else cast('uintptr_t', obj['gcptr32']))
+
def gcval(obj):
return cast('GCobj *', obj['gcptr64'] & LJ_GCVMASK if LJ_GC64
else cast('uintptr_t', obj['gcptr32']))
+
def gcnext(obj):
return gcref(obj)['gch']['nextgc']
+
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
@@ -205,9 +233,11 @@ def L(L=None):
if l:
return cast('lua_State *', l)
+
def G(L):
return mref('global_State *', L['glref'])
+
def J(g):
typeGG = gtype('GG_State')
@@ -215,6 +245,7 @@ def J(g):
- int(typeGG['g'].bitpos / 8)
+ int(typeGG['J'].bitpos / 8))
+
def vm_state(g):
return {
i2notu32(0): 'INTERP',
@@ -228,6 +259,7 @@ def vm_state(g):
i2notu32(8): 'ASM',
}.get(int(tou32(g['vmstate'])), 'TRACE')
+
def gc_state(g):
return {
0: 'PAUSE',
@@ -239,6 +271,7 @@ def gc_state(g):
6: 'LAST',
}.get(int(g['gc']['state']), 'INVALID')
+
def jit_state(g):
return {
0: 'IDLE',
@@ -250,18 +283,22 @@ def jit_state(g):
0x15: 'ERR',
}.get(int(J(g)['state']), 'INVALID')
+
def tvisint(o):
return LJ_DUALNUM and itype(o) == LJ_TISNUM
+
def tvisnumber(o):
return itype(o) <= LJ_TISNUM
+
def tvislightud(o):
if LJ_64 and not LJ_GC64:
return (cast('int32_t', itype(o)) >> 15) == -2
else:
return itype(o) == LJ_T['LIGHTUD']
+
def strdata(obj):
# String is printed with pointer to it, thanks to gdb. Just strip it.
try:
@@ -269,6 +306,7 @@ def strdata(obj):
except UnicodeEncodeError:
return "<luajit-gdb: error occured while rendering non-ascii slot>"
+
def itypemap(o):
if LJ_64 and not LJ_GC64:
return LJ_T['NUMX'] if tvisnumber(o) \
@@ -277,12 +315,14 @@ def itypemap(o):
else:
return LJ_T['NUMX'] if tvisnumber(o) else itype(o)
+
def funcproto(func):
assert(func['ffid'] == 0)
return cast('GCproto *',
mref('char *', func['pc']) - gdb.lookup_type('GCproto').sizeof)
+
def gclistlen(root, end=0x0):
count = 0
while(gcref(root) != end):
@@ -290,6 +330,7 @@ def gclistlen(root, end=0x0):
root = gcnext(root)
return count
+
def gcringlen(root):
if not gcref(root):
return 0
@@ -307,6 +348,7 @@ gclen = {
'mmudata': gcringlen,
}
+
# The generator that implements frame iterator.
# Every frame is represented as a tuple of framelink and frametop.
def frames(L):
@@ -320,6 +362,7 @@ def frames(L):
break
framelink = frame_prev(framelink)
+
def lightudV(tv):
if LJ_64:
u = int(tv['u64'])
@@ -333,33 +376,42 @@ def lightudV(tv):
# Dumpers {{{
+
def dump_lj_tnil(tv):
return 'nil'
+
def dump_lj_tfalse(tv):
return 'false'
+
def dump_lj_ttrue(tv):
return 'true'
+
def dump_lj_tlightud(tv):
return 'light userdata @ {}'.format(strx64(lightudV(tv)))
+
def dump_lj_tstr(tv):
return 'string {body} @ {address}'.format(
body=strdata(gcval(tv['gcr'])),
address=strx64(gcval(tv['gcr']))
)
+
def dump_lj_tupval(tv):
return 'upvalue @ {}'.format(strx64(gcval(tv['gcr'])))
+
def dump_lj_tthread(tv):
return 'thread @ {}'.format(strx64(gcval(tv['gcr'])))
+
def dump_lj_tproto(tv):
return 'proto @ {}'.format(strx64(gcval(tv['gcr'])))
+
def dump_lj_tfunc(tv):
func = cast('struct GCfuncC *', gcval(tv['gcr']))
ffid = func['ffid']
@@ -377,6 +429,7 @@ def dump_lj_tfunc(tv):
else:
return 'fast function #{}'.format(int(ffid))
+
def dump_lj_ttrace(tv):
trace = cast('struct GCtrace *', gcval(tv['gcr']))
return 'trace {traceno} @ {addr}'.format(
@@ -384,9 +437,11 @@ def dump_lj_ttrace(tv):
addr=strx64(trace)
)
+
def dump_lj_tcdata(tv):
return 'cdata @ {}'.format(strx64(gcval(tv['gcr'])))
+
def dump_lj_ttab(tv):
table = cast('GCtab *', gcval(tv['gcr']))
return 'table @ {gcr} (asize: {asize}, hmask: {hmask})'.format(
@@ -395,15 +450,18 @@ def dump_lj_ttab(tv):
hmask=strx64(table['hmask']),
)
+
def dump_lj_tudata(tv):
return 'userdata @ {}'.format(strx64(gcval(tv['gcr'])))
+
def dump_lj_tnumx(tv):
if tvisint(tv):
return 'integer {}'.format(cast('int32_t', tv['i']))
else:
return 'number {}'.format(cast('double', tv['n']))
+
def dump_lj_invalid(tv):
return 'not valid type @ {}'.format(strx64(gcval(tv['gcr'])))
@@ -426,13 +484,16 @@ dumpers = {
'LJ_TNUMX': dump_lj_tnumx,
}
+
def dump_tvalue(tvalue):
return dumpers.get(typenames(itypemap(tvalue)), dump_lj_invalid)(tvalue)
+
def dump_framelink_slot_address(fr):
return '{}:{}'.format(fr - 1, fr) if LJ_FR2 \
else '{}'.format(fr) + PADDING
+
def dump_framelink(L, fr):
if fr == frame_sentinel(L):
return '{addr} [S ] FRAME: dummy L'.format(
@@ -448,6 +509,7 @@ def dump_framelink(L, fr):
f=dump_lj_tfunc(fr - LJ_FR2),
)
+
def dump_stack_slot(L, slot, base=None, top=None):
base = base or L['base']
top = top or L['top']
@@ -461,6 +523,7 @@ def dump_stack_slot(L, slot, base=None, top=None):
value=dump_tvalue(slot),
)
+
def dump_stack(L, base=None, top=None):
base = base or L['base']
top = top or L['top']
@@ -502,6 +565,7 @@ def dump_stack(L, base=None, top=None):
return '\n'.join(dump)
+
def dump_gc(g):
gc = g['gc']
stats = ['{key}: {value}'.format(key=f, value=gc[f]) for f in (
@@ -530,6 +594,7 @@ class LJBase(gdb.Command):
gdb.Command.__init__(self, name, gdb.COMMAND_DATA)
gdb.write('{} command initialized\n'.format(name))
+
class LJDumpArch(LJBase):
'''
lj-arch
@@ -549,6 +614,7 @@ pointers respectively.
)
)
+
class LJDumpTValue(LJBase):
'''
lj-tv <TValue *>
@@ -582,6 +648,7 @@ error message occurs.
tv = cast('TValue *', parse_arg(arg))
gdb.write('{}\n'.format(dump_tvalue(tv)))
+
class LJDumpString(LJBase):
'''
lj-str <GCstr *>
@@ -601,6 +668,7 @@ is replaced with the corresponding error when decoding fails.
len=string['len'],
))
+
class LJDumpTable(LJBase):
'''
lj-tab <GCtab *>
@@ -646,6 +714,7 @@ The command receives a GCtab adress and dumps the table contents:
n=mref('struct Node *', node['next'])
))
+
class LJDumpStack(LJBase):
'''
lj-stack [<lua_State *>]
@@ -682,6 +751,7 @@ If L is ommited the main coroutine is used.
def invoke(self, arg, from_tty):
gdb.write('{}\n'.format(dump_stack(L(parse_arg(arg)))))
+
class LJState(LJBase):
'''
lj-state
@@ -701,6 +771,7 @@ The command requires no args and dumps current VM and GC states
}.items())
)))
+
class LJGC(LJBase):
'''
lj-gc
@@ -727,6 +798,7 @@ The command requires no args and dumps current GC stats:
stats=dump_gc(g)
))
+
def init(commands):
global LJ_64, LJ_GC64, LJ_FR2, LJ_DUALNUM, LJ_TISNUM, PADDING
@@ -783,6 +855,7 @@ def init(commands):
gdb.write('luajit-gdb.py is successfully loaded\n')
+
def load(event=None):
init({
'lj-arch': LJDumpArch,
diff --git a/src/luajit_lldb.py b/src/luajit_lldb.py
index b62705c3..bd8353d5 100644
--- a/src/luajit_lldb.py
+++ b/src/luajit_lldb.py
@@ -21,6 +21,7 @@ LJ_TISNUM = None
# Global
target = None
+
class Ptr:
def __init__(self, value, normal_type):
self.value = value
@@ -82,6 +83,7 @@ class Ptr:
return getattr(self.__deref, name)
return self.__deref
+
class MetaStruct(type):
def __init__(cls, name, bases, nmspc):
super(MetaStruct, cls).__init__(name, bases, nmspc)
@@ -108,6 +110,7 @@ class MetaStruct(type):
property(make_general(field[1], field[0])),
)
+
class Struct(metaclass=MetaStruct):
def __init__(self, value):
self.value = value
@@ -274,6 +277,7 @@ class Command(object):
automatically transformed into proper errors.
"""
+
def cast(typename, value):
pointer_type = False
name = None
@@ -321,31 +325,39 @@ def cast(typename, value):
else:
return casted
+
def lookup_global(name):
return target.FindFirstGlobalVariable(name)
+
def type_member(type_obj, name):
return next((x for x in type_obj.members if x.name == name), None)
+
def find_type(typename):
return target.FindFirstType(typename)
+
def offsetof(typename, membername):
type_obj = find_type(typename)
member = type_member(type_obj, membername)
assert member is not None
return member.GetOffsetInBytes()
+
def sizeof(typename):
type_obj = find_type(typename)
return type_obj.GetByteSize()
+
def vtou64(value):
return value.unsigned & 0xFFFFFFFFFFFFFFFF
+
def vtoi(value):
return value.signed
+
def dbg_eval(expr):
process = target.GetProcess()
thread = process.GetSelectedThread()
@@ -354,17 +366,21 @@ def dbg_eval(expr):
# }}} Debugger specific
+
def gcval(obj):
return cast(GCobjPtr, cast('uintptr_t', obj.gcptr & LJ_GCVMASK) if LJ_GC64
else cast('uintptr_t', obj.gcptr))
+
def gcref(obj):
return cast(GCobjPtr, obj.gcptr if LJ_GC64
else cast('uintptr_t', obj.gcptr))
+
def gcnext(obj):
return gcref(obj).gch.nextgc
+
def gclistlen(root, end=0x0):
count = 0
while(gcref(root) != end):
@@ -372,6 +388,7 @@ def gclistlen(root, end=0x0):
root = gcnext(root)
return count
+
def gcringlen(root):
if not gcref(root):
return 0
@@ -389,6 +406,7 @@ gclen = {
'mmudata': gcringlen,
}
+
def dump_gc(g):
gc = g.gc
stats = ['{key}: {value}'.format(key=f, value=getattr(gc, f)) for f in (
@@ -407,9 +425,11 @@ def dump_gc(g):
) for stat, handler in gclen.items()]
return '\n'.join(map(lambda s: '\t' + s, stats))
+
def mref(typename, obj):
return cast(typename, obj.ptr)
+
def J(g):
g_offset = offsetof('GG_State', 'g')
J_offset = offsetof('GG_State', 'J')
@@ -418,9 +438,11 @@ def J(g):
vtou64(cast('char *', g)) - g_offset + J_offset,
)
+
def G(L):
return mref(global_StatePtr, L.glref)
+
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
@@ -435,12 +457,15 @@ def L(L=None):
if l:
return lua_State(l)
+
def tou32(val):
return val & 0xFFFFFFFF
+
def i2notu32(val):
return ~int(val) & 0xFFFFFFFF
+
def vm_state(g):
return {
i2notu32(0): 'INTERP',
@@ -454,6 +479,7 @@ def vm_state(g):
i2notu32(8): 'ASM',
}.get(int(tou32(g.vmstate)), 'TRACE')
+
def gc_state(g):
return {
0: 'PAUSE',
@@ -465,6 +491,7 @@ def gc_state(g):
6: 'LAST',
}.get(g.gc.state, 'INVALID')
+
def jit_state(g):
return {
0: 'IDLE',
@@ -476,16 +503,19 @@ def jit_state(g):
0x15: 'ERR',
}.get(J(g).state, 'INVALID')
+
def strx64(val):
return re.sub('L?$', '',
hex(int(val) & 0xFFFFFFFFFFFFFFFF))
+
def funcproto(func):
assert(func.ffid == 0)
proto_size = sizeof('GCproto')
value = cast('uintptr_t', vtou64(mref('char *', func.pc)) - proto_size)
return cast(GCprotoPtr, value)
+
def strdata(obj):
try:
ptr = cast('char *', obj + 1)
@@ -493,48 +523,61 @@ def strdata(obj):
except UnicodeEncodeError:
return "<luajit-lldb: error occured while rendering non-ascii slot>"
+
def itype(o):
return tou32(o.it64 >> 47) if LJ_GC64 else o.it
+
def tvisint(o):
return LJ_DUALNUM and itype(o) == LJ_TISNUM
+
def tvislightud(o):
if LJ_64 and not LJ_GC64:
return (vtoi(cast('int32_t', itype(o))) >> 15) == -2
else:
return itype(o) == LJ_T['LIGHTUD']
+
def tvisnumber(o):
return itype(o) <= LJ_TISNUM
+
def dump_lj_tnil(tv):
return 'nil'
+
def dump_lj_tfalse(tv):
return 'false'
+
def dump_lj_ttrue(tv):
return 'true'
+
def dump_lj_tlightud(tv):
return 'light userdata @ {}'.format(strx64(gcval(tv.gcr)))
+
def dump_lj_tstr(tv):
return 'string {body} @ {address}'.format(
body=strdata(cast(GCstrPtr, gcval(tv.gcr))),
address=strx64(gcval(tv.gcr))
)
+
def dump_lj_tupval(tv):
return 'upvalue @ {}'.format(strx64(gcval(tv.gcr)))
+
def dump_lj_tthread(tv):
return 'thread @ {}'.format(strx64(gcval(tv.gcr)))
+
def dump_lj_tproto(tv):
return 'proto @ {}'.format(strx64(gcval(tv.gcr)))
+
def dump_lj_tfunc(tv):
func = cast(GCfuncCPtr, gcval(tv.gcr))
ffid = func.ffid
@@ -552,6 +595,7 @@ def dump_lj_tfunc(tv):
else:
return 'fast function #{}'.format(ffid)
+
def dump_lj_ttrace(tv):
trace = cast(GCtracePtr, gcval(tv.gcr))
return 'trace {traceno} @ {addr}'.format(
@@ -559,9 +603,11 @@ def dump_lj_ttrace(tv):
addr=strx64(trace)
)
+
def dump_lj_tcdata(tv):
return 'cdata @ {}'.format(strx64(gcval(tv.gcr)))
+
def dump_lj_ttab(tv):
table = cast(GCtabPtr, gcval(tv.gcr))
return 'table @ {gcr} (asize: {asize}, hmask: {hmask})'.format(
@@ -570,15 +616,18 @@ def dump_lj_ttab(tv):
hmask=strx64(table.hmask),
)
+
def dump_lj_tudata(tv):
return 'userdata @ {}'.format(strx64(gcval(tv.gcr)))
+
def dump_lj_tnumx(tv):
if tvisint(tv):
return 'integer {}'.format(cast('int32_t', tv.i))
else:
return 'number {}'.format(tv.n)
+
def dump_lj_invalid(tv):
return 'not valid type @ {}'.format(strx64(gcval(tv.gcr)))
@@ -616,6 +665,7 @@ LJ_T = {
'NUMX': i2notu32(13),
}
+
def itypemap(o):
if LJ_64 and not LJ_GC64:
return LJ_T['NUMX'] if tvisnumber(o) \
@@ -623,11 +673,13 @@ def itypemap(o):
else:
return LJ_T['NUMX'] if tvisnumber(o) else itype(o)
+
def typenames(value):
return {
LJ_T[k]: 'LJ_T' + k for k in LJ_T.keys()
}.get(int(value), 'LJ_TINVALID')
+
def dump_tvalue(tvptr):
return dumpers.get(typenames(itypemap(tvptr)), dump_lj_invalid)(tvptr)
@@ -646,6 +698,7 @@ FRAME = {
'PCALLH': 0x7,
}
+
def frametypes(ft):
return {
FRAME['LUA']: 'L',
@@ -654,17 +707,21 @@ def frametypes(ft):
FRAME['VARG']: 'V',
}.get(ft, '?')
+
def bc_a(ins):
return (ins >> 8) & 0xff
+
def frame_ftsz(framelink):
return vtou64(cast('ptrdiff_t', framelink.ftsz if LJ_FR2 \
else framelink.fr.tp.ftsz))
+
def frame_pc(framelink):
return cast(BCInsPtr, frame_ftsz(framelink)) if LJ_FR2 \
else mref(BCInsPtr, framelink.fr.tp.pcr)
+
def frame_prevl(framelink):
# We are evaluating the `frame_pc(framelink)[-1])` with lldb's
# REPL, because the lldb API is faulty and it's not possible to cast
@@ -673,32 +730,41 @@ def frame_prevl(framelink):
# a pointer to it.
return framelink - (1 + LJ_FR2 + bc_a(vtou64(dbg_eval('((BCIns *)' + str(frame_pc(framelink)) + ')[-1]'))))
+
def frame_ispcall(framelink):
return (frame_ftsz(framelink) & FRAME['PCALL']) == FRAME['PCALL']
+
def frame_sized(framelink):
return (frame_ftsz(framelink) & ~FRAME_TYPEP)
+
def frame_prevd(framelink):
return framelink - int(frame_sized(framelink) / sizeof('TValue'))
+
def frame_type(framelink):
return frame_ftsz(framelink) & FRAME_TYPE
+
def frame_typep(framelink):
return frame_ftsz(framelink) & FRAME_TYPEP
+
def frame_islua(framelink):
return frametypes(frame_type(framelink)) == 'L' \
and frame_ftsz(framelink) > 0
+
def frame_prev(framelink):
return frame_prevl(framelink) if frame_islua(framelink) \
else frame_prevd(framelink)
+
def frame_sentinel(L):
return mref(TValuePtr, L.stack) + LJ_FR2
+
# The generator that implements frame iterator.
# Every frame is represented as a tuple of framelink and frametop.
def frames(L):
@@ -712,6 +778,7 @@ def frames(L):
break
framelink = frame_prev(framelink)
+
def dump_framelink_slot_address(fr):
return '{start:{padding}}:{end:{padding}}'.format(
start=hex(int(fr - 1)),
@@ -722,6 +789,7 @@ def dump_framelink_slot_address(fr):
padding=len(PADDING),
)
+
def dump_framelink(L, fr):
if fr == frame_sentinel(L):
return '{addr} [S ] FRAME: dummy L'.format(
@@ -737,6 +805,7 @@ def dump_framelink(L, fr):
f=dump_lj_tfunc(fr - LJ_FR2),
)
+
def dump_stack_slot(L, slot, base=None, top=None):
base = base or L.base
top = top or L.top
@@ -750,6 +819,7 @@ def dump_stack_slot(L, slot, base=None, top=None):
value=dump_tvalue(slot),
)
+
def dump_stack(L, base=None, top=None):
base = base or L.base
top = top or L.top
@@ -845,6 +915,7 @@ The command requires no args and dumps current VM and GC states
}.items())
)))
+
class LJDumpArch(Command):
'''
lj-arch
@@ -863,6 +934,7 @@ pointers respectively.
)
)
+
class LJGC(Command):
'''
lj-gc
@@ -888,6 +960,7 @@ The command requires no args and dumps current GC stats:
stats=dump_gc(g)
))
+
class LJDumpString(Command):
'''
lj-str <GCstr *>
@@ -906,6 +979,7 @@ is replaced with the corresponding error when decoding fails.
len=string_ptr.len,
))
+
class LJDumpTable(Command):
'''
lj-tab <GCtab *>
@@ -950,6 +1024,7 @@ The command receives a GCtab adress and dumps the table contents:
n=strx64(mref(NodePtr, node.next))
))
+
class LJDumpStack(Command):
'''
lj-stack [<lua_State *>]
@@ -999,6 +1074,7 @@ def register_commands(debugger, commands):
)
print('{cmd} command intialized'.format(cmd=cls.command))
+
def configure(debugger):
global LJ_64, LJ_GC64, LJ_FR2, LJ_DUALNUM, PADDING, LJ_TISNUM, target
target = debugger.GetSelectedTarget()
--
2.30.2
^ permalink raw reply [flat|nested] 68+ messages in thread
* Re: [Tarantool-patches] [PATCH luajit 08/15] test: fix E302 errors by pycodestyle
2023-08-03 7:30 ` [Tarantool-patches] [PATCH luajit 08/15] test: fix E302 " Igor Munkin via Tarantool-patches
@ 2023-08-03 14:28 ` Sergey Bronnikov via Tarantool-patches
2023-08-03 16:02 ` Maxim Kokryashkin via Tarantool-patches
1 sibling, 0 replies; 68+ messages in thread
From: Sergey Bronnikov via Tarantool-patches @ 2023-08-03 14:28 UTC (permalink / raw)
To: Igor Munkin, Maxim Kokryashkin; +Cc: tarantool-patches
LGTM
On 8/3/23 10:30, Igor Munkin wrote:
> Fixed 149 occurrences of E302 ("expected 2 blank lines, found 1") error
> reported by pycodestyle[1].
>
> [1]: https://www.flake8rules.com/rules/E302.html
>
> Signed-off-by: Igor Munkin <imun@tarantool.org>
> ---
> src/luajit-gdb.py | 73 ++++++++++++++++++++++++++++++++++++++++++++
> src/luajit_lldb.py | 76 ++++++++++++++++++++++++++++++++++++++++++++++
> 2 files changed, 149 insertions(+)
>
> diff --git a/src/luajit-gdb.py b/src/luajit-gdb.py
> index f87063f8..9c51be0b 100644
> --- a/src/luajit-gdb.py
> +++ b/src/luajit-gdb.py
> @@ -18,6 +18,7 @@ if LEGACY:
>
> gtype_cache = {}
>
> +
> def gtype(typestr):
> global gtype_cache
> if typestr in gtype_cache:
> @@ -31,13 +32,16 @@ def gtype(typestr):
> gtype_cache[typestr] = gtype
> return gtype
>
> +
> def cast(typestr, val):
> return gdb.Value(val).cast(gtype(typestr))
>
> +
> def lookup(symbol):
> variable, _ = gdb.lookup_symbol(symbol)
> return variable.value() if variable else None
>
> +
> def parse_arg(arg):
> if not arg:
> return None
> @@ -49,15 +53,19 @@ def parse_arg(arg):
>
> return ret
>
> +
> def tou64(val):
> return cast('uint64_t', val) & 0xFFFFFFFFFFFFFFFF
>
> +
> def tou32(val):
> return cast('uint32_t', val) & 0xFFFFFFFF
>
> +
> def i2notu32(val):
> return ~int(val) & 0xFFFFFFFF
>
> +
> def strx64(val):
> return re.sub('L?$', '',
> hex(int(cast('uint64_t', val) & 0xFFFFFFFFFFFFFFFF)))
> @@ -81,6 +89,7 @@ LJ_T = {
> 'NUMX': i2notu32(13),
> }
>
> +
> def typenames(value):
> return {
> LJ_T[k]: 'LJ_T' + k for k in LJ_T.keys()
> @@ -105,6 +114,7 @@ FRAME = {
> 'PCALLH': 0x7,
> }
>
> +
> def frametypes(ft):
> return {
> FRAME['LUA']: 'L',
> @@ -113,43 +123,55 @@ def frametypes(ft):
> FRAME['VARG']: 'V',
> }.get(ft, '?')
>
> +
> def bc_a(ins):
> return (ins >> 8) & 0xff
>
> +
> def frame_ftsz(framelink):
> return cast('ptrdiff_t', framelink['ftsz'] if LJ_FR2 \
> else framelink['fr']['tp']['ftsz'])
>
> +
> def frame_pc(framelink):
> return cast('BCIns *', frame_ftsz(framelink)) if LJ_FR2 \
> else mref('BCIns *', framelink['fr']['tp']['pcr'])
>
> +
> def frame_prevl(framelink):
> return framelink - (1 + LJ_FR2 + bc_a(frame_pc(framelink)[-1]))
>
> +
> def frame_ispcall(framelink):
> return (frame_ftsz(framelink) & FRAME['PCALL']) == FRAME['PCALL']
>
> +
> def frame_sized(framelink):
> return (frame_ftsz(framelink) & ~FRAME_TYPEP)
>
> +
> def frame_prevd(framelink):
> return cast('TValue *', cast('char *', framelink) - frame_sized(framelink))
>
> +
> def frame_type(framelink):
> return frame_ftsz(framelink) & FRAME_TYPE
>
> +
> def frame_typep(framelink):
> return frame_ftsz(framelink) & FRAME_TYPEP
>
> +
> def frame_islua(framelink):
> return frametypes(int(frame_type(framelink))) == 'L' \
> and int(frame_ftsz(framelink)) > 0
>
> +
> def frame_prev(framelink):
> return frame_prevl(framelink) if frame_islua(framelink) \
> else frame_prevd(framelink)
>
> +
> def frame_sentinel(L):
> return mref('TValue *', L['stack']) + LJ_FR2
>
> @@ -174,23 +196,29 @@ LIGHTUD_LO_MASK = (1 << LJ_LIGHTUD_BITS_LO) - 1
>
> # }}}
>
> +
> def itype(o):
> return cast('uint32_t', o['it64'] >> 47) if LJ_GC64 else o['it']
>
> +
> def mref(typename, obj):
> return cast(typename, obj['ptr64'] if LJ_GC64 else obj['ptr32'])
>
> +
> def gcref(obj):
> return cast('GCobj *', obj['gcptr64'] if LJ_GC64
> else cast('uintptr_t', obj['gcptr32']))
>
> +
> def gcval(obj):
> return cast('GCobj *', obj['gcptr64'] & LJ_GCVMASK if LJ_GC64
> else cast('uintptr_t', obj['gcptr32']))
>
> +
> def gcnext(obj):
> return gcref(obj)['gch']['nextgc']
>
> +
> 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
> @@ -205,9 +233,11 @@ def L(L=None):
> if l:
> return cast('lua_State *', l)
>
> +
> def G(L):
> return mref('global_State *', L['glref'])
>
> +
> def J(g):
> typeGG = gtype('GG_State')
>
> @@ -215,6 +245,7 @@ def J(g):
> - int(typeGG['g'].bitpos / 8)
> + int(typeGG['J'].bitpos / 8))
>
> +
> def vm_state(g):
> return {
> i2notu32(0): 'INTERP',
> @@ -228,6 +259,7 @@ def vm_state(g):
> i2notu32(8): 'ASM',
> }.get(int(tou32(g['vmstate'])), 'TRACE')
>
> +
> def gc_state(g):
> return {
> 0: 'PAUSE',
> @@ -239,6 +271,7 @@ def gc_state(g):
> 6: 'LAST',
> }.get(int(g['gc']['state']), 'INVALID')
>
> +
> def jit_state(g):
> return {
> 0: 'IDLE',
> @@ -250,18 +283,22 @@ def jit_state(g):
> 0x15: 'ERR',
> }.get(int(J(g)['state']), 'INVALID')
>
> +
> def tvisint(o):
> return LJ_DUALNUM and itype(o) == LJ_TISNUM
>
> +
> def tvisnumber(o):
> return itype(o) <= LJ_TISNUM
>
> +
> def tvislightud(o):
> if LJ_64 and not LJ_GC64:
> return (cast('int32_t', itype(o)) >> 15) == -2
> else:
> return itype(o) == LJ_T['LIGHTUD']
>
> +
> def strdata(obj):
> # String is printed with pointer to it, thanks to gdb. Just strip it.
> try:
> @@ -269,6 +306,7 @@ def strdata(obj):
> except UnicodeEncodeError:
> return "<luajit-gdb: error occured while rendering non-ascii slot>"
>
> +
> def itypemap(o):
> if LJ_64 and not LJ_GC64:
> return LJ_T['NUMX'] if tvisnumber(o) \
> @@ -277,12 +315,14 @@ def itypemap(o):
> else:
> return LJ_T['NUMX'] if tvisnumber(o) else itype(o)
>
> +
> def funcproto(func):
> assert(func['ffid'] == 0)
>
> return cast('GCproto *',
> mref('char *', func['pc']) - gdb.lookup_type('GCproto').sizeof)
>
> +
> def gclistlen(root, end=0x0):
> count = 0
> while(gcref(root) != end):
> @@ -290,6 +330,7 @@ def gclistlen(root, end=0x0):
> root = gcnext(root)
> return count
>
> +
> def gcringlen(root):
> if not gcref(root):
> return 0
> @@ -307,6 +348,7 @@ gclen = {
> 'mmudata': gcringlen,
> }
>
> +
> # The generator that implements frame iterator.
> # Every frame is represented as a tuple of framelink and frametop.
> def frames(L):
> @@ -320,6 +362,7 @@ def frames(L):
> break
> framelink = frame_prev(framelink)
>
> +
> def lightudV(tv):
> if LJ_64:
> u = int(tv['u64'])
> @@ -333,33 +376,42 @@ def lightudV(tv):
>
> # Dumpers {{{
>
> +
> def dump_lj_tnil(tv):
> return 'nil'
>
> +
> def dump_lj_tfalse(tv):
> return 'false'
>
> +
> def dump_lj_ttrue(tv):
> return 'true'
>
> +
> def dump_lj_tlightud(tv):
> return 'light userdata @ {}'.format(strx64(lightudV(tv)))
>
> +
> def dump_lj_tstr(tv):
> return 'string {body} @ {address}'.format(
> body=strdata(gcval(tv['gcr'])),
> address=strx64(gcval(tv['gcr']))
> )
>
> +
> def dump_lj_tupval(tv):
> return 'upvalue @ {}'.format(strx64(gcval(tv['gcr'])))
>
> +
> def dump_lj_tthread(tv):
> return 'thread @ {}'.format(strx64(gcval(tv['gcr'])))
>
> +
> def dump_lj_tproto(tv):
> return 'proto @ {}'.format(strx64(gcval(tv['gcr'])))
>
> +
> def dump_lj_tfunc(tv):
> func = cast('struct GCfuncC *', gcval(tv['gcr']))
> ffid = func['ffid']
> @@ -377,6 +429,7 @@ def dump_lj_tfunc(tv):
> else:
> return 'fast function #{}'.format(int(ffid))
>
> +
> def dump_lj_ttrace(tv):
> trace = cast('struct GCtrace *', gcval(tv['gcr']))
> return 'trace {traceno} @ {addr}'.format(
> @@ -384,9 +437,11 @@ def dump_lj_ttrace(tv):
> addr=strx64(trace)
> )
>
> +
> def dump_lj_tcdata(tv):
> return 'cdata @ {}'.format(strx64(gcval(tv['gcr'])))
>
> +
> def dump_lj_ttab(tv):
> table = cast('GCtab *', gcval(tv['gcr']))
> return 'table @ {gcr} (asize: {asize}, hmask: {hmask})'.format(
> @@ -395,15 +450,18 @@ def dump_lj_ttab(tv):
> hmask=strx64(table['hmask']),
> )
>
> +
> def dump_lj_tudata(tv):
> return 'userdata @ {}'.format(strx64(gcval(tv['gcr'])))
>
> +
> def dump_lj_tnumx(tv):
> if tvisint(tv):
> return 'integer {}'.format(cast('int32_t', tv['i']))
> else:
> return 'number {}'.format(cast('double', tv['n']))
>
> +
> def dump_lj_invalid(tv):
> return 'not valid type @ {}'.format(strx64(gcval(tv['gcr'])))
>
> @@ -426,13 +484,16 @@ dumpers = {
> 'LJ_TNUMX': dump_lj_tnumx,
> }
>
> +
> def dump_tvalue(tvalue):
> return dumpers.get(typenames(itypemap(tvalue)), dump_lj_invalid)(tvalue)
>
> +
> def dump_framelink_slot_address(fr):
> return '{}:{}'.format(fr - 1, fr) if LJ_FR2 \
> else '{}'.format(fr) + PADDING
>
> +
> def dump_framelink(L, fr):
> if fr == frame_sentinel(L):
> return '{addr} [S ] FRAME: dummy L'.format(
> @@ -448,6 +509,7 @@ def dump_framelink(L, fr):
> f=dump_lj_tfunc(fr - LJ_FR2),
> )
>
> +
> def dump_stack_slot(L, slot, base=None, top=None):
> base = base or L['base']
> top = top or L['top']
> @@ -461,6 +523,7 @@ def dump_stack_slot(L, slot, base=None, top=None):
> value=dump_tvalue(slot),
> )
>
> +
> def dump_stack(L, base=None, top=None):
> base = base or L['base']
> top = top or L['top']
> @@ -502,6 +565,7 @@ def dump_stack(L, base=None, top=None):
>
> return '\n'.join(dump)
>
> +
> def dump_gc(g):
> gc = g['gc']
> stats = ['{key}: {value}'.format(key=f, value=gc[f]) for f in (
> @@ -530,6 +594,7 @@ class LJBase(gdb.Command):
> gdb.Command.__init__(self, name, gdb.COMMAND_DATA)
> gdb.write('{} command initialized\n'.format(name))
>
> +
> class LJDumpArch(LJBase):
> '''
> lj-arch
> @@ -549,6 +614,7 @@ pointers respectively.
> )
> )
>
> +
> class LJDumpTValue(LJBase):
> '''
> lj-tv <TValue *>
> @@ -582,6 +648,7 @@ error message occurs.
> tv = cast('TValue *', parse_arg(arg))
> gdb.write('{}\n'.format(dump_tvalue(tv)))
>
> +
> class LJDumpString(LJBase):
> '''
> lj-str <GCstr *>
> @@ -601,6 +668,7 @@ is replaced with the corresponding error when decoding fails.
> len=string['len'],
> ))
>
> +
> class LJDumpTable(LJBase):
> '''
> lj-tab <GCtab *>
> @@ -646,6 +714,7 @@ The command receives a GCtab adress and dumps the table contents:
> n=mref('struct Node *', node['next'])
> ))
>
> +
> class LJDumpStack(LJBase):
> '''
> lj-stack [<lua_State *>]
> @@ -682,6 +751,7 @@ If L is ommited the main coroutine is used.
> def invoke(self, arg, from_tty):
> gdb.write('{}\n'.format(dump_stack(L(parse_arg(arg)))))
>
> +
> class LJState(LJBase):
> '''
> lj-state
> @@ -701,6 +771,7 @@ The command requires no args and dumps current VM and GC states
> }.items())
> )))
>
> +
> class LJGC(LJBase):
> '''
> lj-gc
> @@ -727,6 +798,7 @@ The command requires no args and dumps current GC stats:
> stats=dump_gc(g)
> ))
>
> +
> def init(commands):
> global LJ_64, LJ_GC64, LJ_FR2, LJ_DUALNUM, LJ_TISNUM, PADDING
>
> @@ -783,6 +855,7 @@ def init(commands):
>
> gdb.write('luajit-gdb.py is successfully loaded\n')
>
> +
> def load(event=None):
> init({
> 'lj-arch': LJDumpArch,
> diff --git a/src/luajit_lldb.py b/src/luajit_lldb.py
> index b62705c3..bd8353d5 100644
> --- a/src/luajit_lldb.py
> +++ b/src/luajit_lldb.py
> @@ -21,6 +21,7 @@ LJ_TISNUM = None
> # Global
> target = None
>
> +
> class Ptr:
> def __init__(self, value, normal_type):
> self.value = value
> @@ -82,6 +83,7 @@ class Ptr:
> return getattr(self.__deref, name)
> return self.__deref
>
> +
> class MetaStruct(type):
> def __init__(cls, name, bases, nmspc):
> super(MetaStruct, cls).__init__(name, bases, nmspc)
> @@ -108,6 +110,7 @@ class MetaStruct(type):
> property(make_general(field[1], field[0])),
> )
>
> +
> class Struct(metaclass=MetaStruct):
> def __init__(self, value):
> self.value = value
> @@ -274,6 +277,7 @@ class Command(object):
> automatically transformed into proper errors.
> """
>
> +
> def cast(typename, value):
> pointer_type = False
> name = None
> @@ -321,31 +325,39 @@ def cast(typename, value):
> else:
> return casted
>
> +
> def lookup_global(name):
> return target.FindFirstGlobalVariable(name)
>
> +
> def type_member(type_obj, name):
> return next((x for x in type_obj.members if x.name == name), None)
>
> +
> def find_type(typename):
> return target.FindFirstType(typename)
>
> +
> def offsetof(typename, membername):
> type_obj = find_type(typename)
> member = type_member(type_obj, membername)
> assert member is not None
> return member.GetOffsetInBytes()
>
> +
> def sizeof(typename):
> type_obj = find_type(typename)
> return type_obj.GetByteSize()
>
> +
> def vtou64(value):
> return value.unsigned & 0xFFFFFFFFFFFFFFFF
>
> +
> def vtoi(value):
> return value.signed
>
> +
> def dbg_eval(expr):
> process = target.GetProcess()
> thread = process.GetSelectedThread()
> @@ -354,17 +366,21 @@ def dbg_eval(expr):
>
> # }}} Debugger specific
>
> +
> def gcval(obj):
> return cast(GCobjPtr, cast('uintptr_t', obj.gcptr & LJ_GCVMASK) if LJ_GC64
> else cast('uintptr_t', obj.gcptr))
>
> +
> def gcref(obj):
> return cast(GCobjPtr, obj.gcptr if LJ_GC64
> else cast('uintptr_t', obj.gcptr))
>
> +
> def gcnext(obj):
> return gcref(obj).gch.nextgc
>
> +
> def gclistlen(root, end=0x0):
> count = 0
> while(gcref(root) != end):
> @@ -372,6 +388,7 @@ def gclistlen(root, end=0x0):
> root = gcnext(root)
> return count
>
> +
> def gcringlen(root):
> if not gcref(root):
> return 0
> @@ -389,6 +406,7 @@ gclen = {
> 'mmudata': gcringlen,
> }
>
> +
> def dump_gc(g):
> gc = g.gc
> stats = ['{key}: {value}'.format(key=f, value=getattr(gc, f)) for f in (
> @@ -407,9 +425,11 @@ def dump_gc(g):
> ) for stat, handler in gclen.items()]
> return '\n'.join(map(lambda s: '\t' + s, stats))
>
> +
> def mref(typename, obj):
> return cast(typename, obj.ptr)
>
> +
> def J(g):
> g_offset = offsetof('GG_State', 'g')
> J_offset = offsetof('GG_State', 'J')
> @@ -418,9 +438,11 @@ def J(g):
> vtou64(cast('char *', g)) - g_offset + J_offset,
> )
>
> +
> def G(L):
> return mref(global_StatePtr, L.glref)
>
> +
> 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
> @@ -435,12 +457,15 @@ def L(L=None):
> if l:
> return lua_State(l)
>
> +
> def tou32(val):
> return val & 0xFFFFFFFF
>
> +
> def i2notu32(val):
> return ~int(val) & 0xFFFFFFFF
>
> +
> def vm_state(g):
> return {
> i2notu32(0): 'INTERP',
> @@ -454,6 +479,7 @@ def vm_state(g):
> i2notu32(8): 'ASM',
> }.get(int(tou32(g.vmstate)), 'TRACE')
>
> +
> def gc_state(g):
> return {
> 0: 'PAUSE',
> @@ -465,6 +491,7 @@ def gc_state(g):
> 6: 'LAST',
> }.get(g.gc.state, 'INVALID')
>
> +
> def jit_state(g):
> return {
> 0: 'IDLE',
> @@ -476,16 +503,19 @@ def jit_state(g):
> 0x15: 'ERR',
> }.get(J(g).state, 'INVALID')
>
> +
> def strx64(val):
> return re.sub('L?$', '',
> hex(int(val) & 0xFFFFFFFFFFFFFFFF))
>
> +
> def funcproto(func):
> assert(func.ffid == 0)
> proto_size = sizeof('GCproto')
> value = cast('uintptr_t', vtou64(mref('char *', func.pc)) - proto_size)
> return cast(GCprotoPtr, value)
>
> +
> def strdata(obj):
> try:
> ptr = cast('char *', obj + 1)
> @@ -493,48 +523,61 @@ def strdata(obj):
> except UnicodeEncodeError:
> return "<luajit-lldb: error occured while rendering non-ascii slot>"
>
> +
> def itype(o):
> return tou32(o.it64 >> 47) if LJ_GC64 else o.it
>
> +
> def tvisint(o):
> return LJ_DUALNUM and itype(o) == LJ_TISNUM
>
> +
> def tvislightud(o):
> if LJ_64 and not LJ_GC64:
> return (vtoi(cast('int32_t', itype(o))) >> 15) == -2
> else:
> return itype(o) == LJ_T['LIGHTUD']
>
> +
> def tvisnumber(o):
> return itype(o) <= LJ_TISNUM
>
> +
> def dump_lj_tnil(tv):
> return 'nil'
>
> +
> def dump_lj_tfalse(tv):
> return 'false'
>
> +
> def dump_lj_ttrue(tv):
> return 'true'
>
> +
> def dump_lj_tlightud(tv):
> return 'light userdata @ {}'.format(strx64(gcval(tv.gcr)))
>
> +
> def dump_lj_tstr(tv):
> return 'string {body} @ {address}'.format(
> body=strdata(cast(GCstrPtr, gcval(tv.gcr))),
> address=strx64(gcval(tv.gcr))
> )
>
> +
> def dump_lj_tupval(tv):
> return 'upvalue @ {}'.format(strx64(gcval(tv.gcr)))
>
> +
> def dump_lj_tthread(tv):
> return 'thread @ {}'.format(strx64(gcval(tv.gcr)))
>
> +
> def dump_lj_tproto(tv):
> return 'proto @ {}'.format(strx64(gcval(tv.gcr)))
>
> +
> def dump_lj_tfunc(tv):
> func = cast(GCfuncCPtr, gcval(tv.gcr))
> ffid = func.ffid
> @@ -552,6 +595,7 @@ def dump_lj_tfunc(tv):
> else:
> return 'fast function #{}'.format(ffid)
>
> +
> def dump_lj_ttrace(tv):
> trace = cast(GCtracePtr, gcval(tv.gcr))
> return 'trace {traceno} @ {addr}'.format(
> @@ -559,9 +603,11 @@ def dump_lj_ttrace(tv):
> addr=strx64(trace)
> )
>
> +
> def dump_lj_tcdata(tv):
> return 'cdata @ {}'.format(strx64(gcval(tv.gcr)))
>
> +
> def dump_lj_ttab(tv):
> table = cast(GCtabPtr, gcval(tv.gcr))
> return 'table @ {gcr} (asize: {asize}, hmask: {hmask})'.format(
> @@ -570,15 +616,18 @@ def dump_lj_ttab(tv):
> hmask=strx64(table.hmask),
> )
>
> +
> def dump_lj_tudata(tv):
> return 'userdata @ {}'.format(strx64(gcval(tv.gcr)))
>
> +
> def dump_lj_tnumx(tv):
> if tvisint(tv):
> return 'integer {}'.format(cast('int32_t', tv.i))
> else:
> return 'number {}'.format(tv.n)
>
> +
> def dump_lj_invalid(tv):
> return 'not valid type @ {}'.format(strx64(gcval(tv.gcr)))
>
> @@ -616,6 +665,7 @@ LJ_T = {
> 'NUMX': i2notu32(13),
> }
>
> +
> def itypemap(o):
> if LJ_64 and not LJ_GC64:
> return LJ_T['NUMX'] if tvisnumber(o) \
> @@ -623,11 +673,13 @@ def itypemap(o):
> else:
> return LJ_T['NUMX'] if tvisnumber(o) else itype(o)
>
> +
> def typenames(value):
> return {
> LJ_T[k]: 'LJ_T' + k for k in LJ_T.keys()
> }.get(int(value), 'LJ_TINVALID')
>
> +
> def dump_tvalue(tvptr):
> return dumpers.get(typenames(itypemap(tvptr)), dump_lj_invalid)(tvptr)
>
> @@ -646,6 +698,7 @@ FRAME = {
> 'PCALLH': 0x7,
> }
>
> +
> def frametypes(ft):
> return {
> FRAME['LUA']: 'L',
> @@ -654,17 +707,21 @@ def frametypes(ft):
> FRAME['VARG']: 'V',
> }.get(ft, '?')
>
> +
> def bc_a(ins):
> return (ins >> 8) & 0xff
>
> +
> def frame_ftsz(framelink):
> return vtou64(cast('ptrdiff_t', framelink.ftsz if LJ_FR2 \
> else framelink.fr.tp.ftsz))
>
> +
> def frame_pc(framelink):
> return cast(BCInsPtr, frame_ftsz(framelink)) if LJ_FR2 \
> else mref(BCInsPtr, framelink.fr.tp.pcr)
>
> +
> def frame_prevl(framelink):
> # We are evaluating the `frame_pc(framelink)[-1])` with lldb's
> # REPL, because the lldb API is faulty and it's not possible to cast
> @@ -673,32 +730,41 @@ def frame_prevl(framelink):
> # a pointer to it.
> return framelink - (1 + LJ_FR2 + bc_a(vtou64(dbg_eval('((BCIns *)' + str(frame_pc(framelink)) + ')[-1]'))))
>
> +
> def frame_ispcall(framelink):
> return (frame_ftsz(framelink) & FRAME['PCALL']) == FRAME['PCALL']
>
> +
> def frame_sized(framelink):
> return (frame_ftsz(framelink) & ~FRAME_TYPEP)
>
> +
> def frame_prevd(framelink):
> return framelink - int(frame_sized(framelink) / sizeof('TValue'))
>
> +
> def frame_type(framelink):
> return frame_ftsz(framelink) & FRAME_TYPE
>
> +
> def frame_typep(framelink):
> return frame_ftsz(framelink) & FRAME_TYPEP
>
> +
> def frame_islua(framelink):
> return frametypes(frame_type(framelink)) == 'L' \
> and frame_ftsz(framelink) > 0
>
> +
> def frame_prev(framelink):
> return frame_prevl(framelink) if frame_islua(framelink) \
> else frame_prevd(framelink)
>
> +
> def frame_sentinel(L):
> return mref(TValuePtr, L.stack) + LJ_FR2
>
> +
> # The generator that implements frame iterator.
> # Every frame is represented as a tuple of framelink and frametop.
> def frames(L):
> @@ -712,6 +778,7 @@ def frames(L):
> break
> framelink = frame_prev(framelink)
>
> +
> def dump_framelink_slot_address(fr):
> return '{start:{padding}}:{end:{padding}}'.format(
> start=hex(int(fr - 1)),
> @@ -722,6 +789,7 @@ def dump_framelink_slot_address(fr):
> padding=len(PADDING),
> )
>
> +
> def dump_framelink(L, fr):
> if fr == frame_sentinel(L):
> return '{addr} [S ] FRAME: dummy L'.format(
> @@ -737,6 +805,7 @@ def dump_framelink(L, fr):
> f=dump_lj_tfunc(fr - LJ_FR2),
> )
>
> +
> def dump_stack_slot(L, slot, base=None, top=None):
> base = base or L.base
> top = top or L.top
> @@ -750,6 +819,7 @@ def dump_stack_slot(L, slot, base=None, top=None):
> value=dump_tvalue(slot),
> )
>
> +
> def dump_stack(L, base=None, top=None):
> base = base or L.base
> top = top or L.top
> @@ -845,6 +915,7 @@ The command requires no args and dumps current VM and GC states
> }.items())
> )))
>
> +
> class LJDumpArch(Command):
> '''
> lj-arch
> @@ -863,6 +934,7 @@ pointers respectively.
> )
> )
>
> +
> class LJGC(Command):
> '''
> lj-gc
> @@ -888,6 +960,7 @@ The command requires no args and dumps current GC stats:
> stats=dump_gc(g)
> ))
>
> +
> class LJDumpString(Command):
> '''
> lj-str <GCstr *>
> @@ -906,6 +979,7 @@ is replaced with the corresponding error when decoding fails.
> len=string_ptr.len,
> ))
>
> +
> class LJDumpTable(Command):
> '''
> lj-tab <GCtab *>
> @@ -950,6 +1024,7 @@ The command receives a GCtab adress and dumps the table contents:
> n=strx64(mref(NodePtr, node.next))
> ))
>
> +
> class LJDumpStack(Command):
> '''
> lj-stack [<lua_State *>]
> @@ -999,6 +1074,7 @@ def register_commands(debugger, commands):
> )
> print('{cmd} command intialized'.format(cmd=cls.command))
>
> +
> def configure(debugger):
> global LJ_64, LJ_GC64, LJ_FR2, LJ_DUALNUM, PADDING, LJ_TISNUM, target
> target = debugger.GetSelectedTarget()
^ permalink raw reply [flat|nested] 68+ messages in thread
* Re: [Tarantool-patches] [PATCH luajit 08/15] test: fix E302 errors by pycodestyle
2023-08-03 7:30 ` [Tarantool-patches] [PATCH luajit 08/15] test: fix E302 " Igor Munkin via Tarantool-patches
2023-08-03 14:28 ` Sergey Bronnikov via Tarantool-patches
@ 2023-08-03 16:02 ` Maxim Kokryashkin via Tarantool-patches
1 sibling, 0 replies; 68+ messages in thread
From: Maxim Kokryashkin via Tarantool-patches @ 2023-08-03 16:02 UTC (permalink / raw)
To: Igor Munkin; +Cc: tarantool-patches
[-- Attachment #1: Type: text/plain, Size: 26398 bytes --]
Hi, Igor!
Thanks for the patch!
LGTM
--
Best regards,
Maxim Kokryashkin
>
>>Fixed 149 occurrences of E302 ("expected 2 blank lines, found 1") error
>>reported by pycodestyle[1].
>>
>>[1]: https://www.flake8rules.com/rules/E302.html
>>
>>Signed-off-by: Igor Munkin < imun@tarantool.org >
>>---
>> src/luajit-gdb.py | 73 ++++++++++++++++++++++++++++++++++++++++++++
>> src/luajit_lldb.py | 76 ++++++++++++++++++++++++++++++++++++++++++++++
>> 2 files changed, 149 insertions(+)
>>
>>diff --git a/src/luajit-gdb.py b/src/luajit-gdb.py
>>index f87063f8..9c51be0b 100644
>>--- a/src/luajit-gdb.py
>>+++ b/src/luajit-gdb.py
>>@@ -18,6 +18,7 @@ if LEGACY:
>>
>> gtype_cache = {}
>>
>>+
>> def gtype(typestr):
>> global gtype_cache
>> if typestr in gtype_cache:
>>@@ -31,13 +32,16 @@ def gtype(typestr):
>> gtype_cache[typestr] = gtype
>> return gtype
>>
>>+
>> def cast(typestr, val):
>> return gdb.Value(val).cast(gtype(typestr))
>>
>>+
>> def lookup(symbol):
>> variable, _ = gdb.lookup_symbol(symbol)
>> return variable.value() if variable else None
>>
>>+
>> def parse_arg(arg):
>> if not arg:
>> return None
>>@@ -49,15 +53,19 @@ def parse_arg(arg):
>>
>> return ret
>>
>>+
>> def tou64(val):
>> return cast('uint64_t', val) & 0xFFFFFFFFFFFFFFFF
>>
>>+
>> def tou32(val):
>> return cast('uint32_t', val) & 0xFFFFFFFF
>>
>>+
>> def i2notu32(val):
>> return ~int(val) & 0xFFFFFFFF
>>
>>+
>> def strx64(val):
>> return re.sub('L?$', '',
>> hex(int(cast('uint64_t', val) & 0xFFFFFFFFFFFFFFFF)))
>>@@ -81,6 +89,7 @@ LJ_T = {
>> 'NUMX': i2notu32(13),
>> }
>>
>>+
>> def typenames(value):
>> return {
>> LJ_T[k]: 'LJ_T' + k for k in LJ_T.keys()
>>@@ -105,6 +114,7 @@ FRAME = {
>> 'PCALLH': 0x7,
>> }
>>
>>+
>> def frametypes(ft):
>> return {
>> FRAME['LUA']: 'L',
>>@@ -113,43 +123,55 @@ def frametypes(ft):
>> FRAME['VARG']: 'V',
>> }.get(ft, '?')
>>
>>+
>> def bc_a(ins):
>> return (ins >> 8) & 0xff
>>
>>+
>> def frame_ftsz(framelink):
>> return cast('ptrdiff_t', framelink['ftsz'] if LJ_FR2 \
>> else framelink['fr']['tp']['ftsz'])
>>
>>+
>> def frame_pc(framelink):
>> return cast('BCIns *', frame_ftsz(framelink)) if LJ_FR2 \
>> else mref('BCIns *', framelink['fr']['tp']['pcr'])
>>
>>+
>> def frame_prevl(framelink):
>> return framelink - (1 + LJ_FR2 + bc_a(frame_pc(framelink)[-1]))
>>
>>+
>> def frame_ispcall(framelink):
>> return (frame_ftsz(framelink) & FRAME['PCALL']) == FRAME['PCALL']
>>
>>+
>> def frame_sized(framelink):
>> return (frame_ftsz(framelink) & ~FRAME_TYPEP)
>>
>>+
>> def frame_prevd(framelink):
>> return cast('TValue *', cast('char *', framelink) - frame_sized(framelink))
>>
>>+
>> def frame_type(framelink):
>> return frame_ftsz(framelink) & FRAME_TYPE
>>
>>+
>> def frame_typep(framelink):
>> return frame_ftsz(framelink) & FRAME_TYPEP
>>
>>+
>> def frame_islua(framelink):
>> return frametypes(int(frame_type(framelink))) == 'L' \
>> and int(frame_ftsz(framelink)) > 0
>>
>>+
>> def frame_prev(framelink):
>> return frame_prevl(framelink) if frame_islua(framelink) \
>> else frame_prevd(framelink)
>>
>>+
>> def frame_sentinel(L):
>> return mref('TValue *', L['stack']) + LJ_FR2
>>
>>@@ -174,23 +196,29 @@ LIGHTUD_LO_MASK = (1 << LJ_LIGHTUD_BITS_LO) - 1
>>
>> # }}}
>>
>>+
>> def itype(o):
>> return cast('uint32_t', o['it64'] >> 47) if LJ_GC64 else o['it']
>>
>>+
>> def mref(typename, obj):
>> return cast(typename, obj['ptr64'] if LJ_GC64 else obj['ptr32'])
>>
>>+
>> def gcref(obj):
>> return cast('GCobj *', obj['gcptr64'] if LJ_GC64
>> else cast('uintptr_t', obj['gcptr32']))
>>
>>+
>> def gcval(obj):
>> return cast('GCobj *', obj['gcptr64'] & LJ_GCVMASK if LJ_GC64
>> else cast('uintptr_t', obj['gcptr32']))
>>
>>+
>> def gcnext(obj):
>> return gcref(obj)['gch']['nextgc']
>>
>>+
>> 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
>>@@ -205,9 +233,11 @@ def L(L=None):
>> if l:
>> return cast('lua_State *', l)
>>
>>+
>> def G(L):
>> return mref('global_State *', L['glref'])
>>
>>+
>> def J(g):
>> typeGG = gtype('GG_State')
>>
>>@@ -215,6 +245,7 @@ def J(g):
>> - int(typeGG['g'].bitpos / 8)
>> + int(typeGG['J'].bitpos / 8))
>>
>>+
>> def vm_state(g):
>> return {
>> i2notu32(0): 'INTERP',
>>@@ -228,6 +259,7 @@ def vm_state(g):
>> i2notu32(8): 'ASM',
>> }.get(int(tou32(g['vmstate'])), 'TRACE')
>>
>>+
>> def gc_state(g):
>> return {
>> 0: 'PAUSE',
>>@@ -239,6 +271,7 @@ def gc_state(g):
>> 6: 'LAST',
>> }.get(int(g['gc']['state']), 'INVALID')
>>
>>+
>> def jit_state(g):
>> return {
>> 0: 'IDLE',
>>@@ -250,18 +283,22 @@ def jit_state(g):
>> 0x15: 'ERR',
>> }.get(int(J(g)['state']), 'INVALID')
>>
>>+
>> def tvisint(o):
>> return LJ_DUALNUM and itype(o) == LJ_TISNUM
>>
>>+
>> def tvisnumber(o):
>> return itype(o) <= LJ_TISNUM
>>
>>+
>> def tvislightud(o):
>> if LJ_64 and not LJ_GC64:
>> return (cast('int32_t', itype(o)) >> 15) == -2
>> else:
>> return itype(o) == LJ_T['LIGHTUD']
>>
>>+
>> def strdata(obj):
>> # String is printed with pointer to it, thanks to gdb. Just strip it.
>> try:
>>@@ -269,6 +306,7 @@ def strdata(obj):
>> except UnicodeEncodeError:
>> return "<luajit-gdb: error occured while rendering non-ascii slot>"
>>
>>+
>> def itypemap(o):
>> if LJ_64 and not LJ_GC64:
>> return LJ_T['NUMX'] if tvisnumber(o) \
>>@@ -277,12 +315,14 @@ def itypemap(o):
>> else:
>> return LJ_T['NUMX'] if tvisnumber(o) else itype(o)
>>
>>+
>> def funcproto(func):
>> assert(func['ffid'] == 0)
>>
>> return cast('GCproto *',
>> mref('char *', func['pc']) - gdb.lookup_type('GCproto').sizeof)
>>
>>+
>> def gclistlen(root, end=0x0):
>> count = 0
>> while(gcref(root) != end):
>>@@ -290,6 +330,7 @@ def gclistlen(root, end=0x0):
>> root = gcnext(root)
>> return count
>>
>>+
>> def gcringlen(root):
>> if not gcref(root):
>> return 0
>>@@ -307,6 +348,7 @@ gclen = {
>> 'mmudata': gcringlen,
>> }
>>
>>+
>> # The generator that implements frame iterator.
>> # Every frame is represented as a tuple of framelink and frametop.
>> def frames(L):
>>@@ -320,6 +362,7 @@ def frames(L):
>> break
>> framelink = frame_prev(framelink)
>>
>>+
>> def lightudV(tv):
>> if LJ_64:
>> u = int(tv['u64'])
>>@@ -333,33 +376,42 @@ def lightudV(tv):
>>
>> # Dumpers {{{
>>
>>+
>> def dump_lj_tnil(tv):
>> return 'nil'
>>
>>+
>> def dump_lj_tfalse(tv):
>> return 'false'
>>
>>+
>> def dump_lj_ttrue(tv):
>> return 'true'
>>
>>+
>> def dump_lj_tlightud(tv):
>> return 'light userdata @ {}'.format(strx64(lightudV(tv)))
>>
>>+
>> def dump_lj_tstr(tv):
>> return 'string {body} @ {address}'.format(
>> body=strdata(gcval(tv['gcr'])),
>> address=strx64(gcval(tv['gcr']))
>> )
>>
>>+
>> def dump_lj_tupval(tv):
>> return 'upvalue @ {}'.format(strx64(gcval(tv['gcr'])))
>>
>>+
>> def dump_lj_tthread(tv):
>> return 'thread @ {}'.format(strx64(gcval(tv['gcr'])))
>>
>>+
>> def dump_lj_tproto(tv):
>> return 'proto @ {}'.format(strx64(gcval(tv['gcr'])))
>>
>>+
>> def dump_lj_tfunc(tv):
>> func = cast('struct GCfuncC *', gcval(tv['gcr']))
>> ffid = func['ffid']
>>@@ -377,6 +429,7 @@ def dump_lj_tfunc(tv):
>> else:
>> return 'fast function #{}'.format(int(ffid))
>>
>>+
>> def dump_lj_ttrace(tv):
>> trace = cast('struct GCtrace *', gcval(tv['gcr']))
>> return 'trace {traceno} @ {addr}'.format(
>>@@ -384,9 +437,11 @@ def dump_lj_ttrace(tv):
>> addr=strx64(trace)
>> )
>>
>>+
>> def dump_lj_tcdata(tv):
>> return 'cdata @ {}'.format(strx64(gcval(tv['gcr'])))
>>
>>+
>> def dump_lj_ttab(tv):
>> table = cast('GCtab *', gcval(tv['gcr']))
>> return 'table @ {gcr} (asize: {asize}, hmask: {hmask})'.format(
>>@@ -395,15 +450,18 @@ def dump_lj_ttab(tv):
>> hmask=strx64(table['hmask']),
>> )
>>
>>+
>> def dump_lj_tudata(tv):
>> return 'userdata @ {}'.format(strx64(gcval(tv['gcr'])))
>>
>>+
>> def dump_lj_tnumx(tv):
>> if tvisint(tv):
>> return 'integer {}'.format(cast('int32_t', tv['i']))
>> else:
>> return 'number {}'.format(cast('double', tv['n']))
>>
>>+
>> def dump_lj_invalid(tv):
>> return 'not valid type @ {}'.format(strx64(gcval(tv['gcr'])))
>>
>>@@ -426,13 +484,16 @@ dumpers = {
>> 'LJ_TNUMX': dump_lj_tnumx,
>> }
>>
>>+
>> def dump_tvalue(tvalue):
>> return dumpers.get(typenames(itypemap(tvalue)), dump_lj_invalid)(tvalue)
>>
>>+
>> def dump_framelink_slot_address(fr):
>> return '{}:{}'.format(fr - 1, fr) if LJ_FR2 \
>> else '{}'.format(fr) + PADDING
>>
>>+
>> def dump_framelink(L, fr):
>> if fr == frame_sentinel(L):
>> return '{addr} [S ] FRAME: dummy L'.format(
>>@@ -448,6 +509,7 @@ def dump_framelink(L, fr):
>> f=dump_lj_tfunc(fr - LJ_FR2),
>> )
>>
>>+
>> def dump_stack_slot(L, slot, base=None, top=None):
>> base = base or L['base']
>> top = top or L['top']
>>@@ -461,6 +523,7 @@ def dump_stack_slot(L, slot, base=None, top=None):
>> value=dump_tvalue(slot),
>> )
>>
>>+
>> def dump_stack(L, base=None, top=None):
>> base = base or L['base']
>> top = top or L['top']
>>@@ -502,6 +565,7 @@ def dump_stack(L, base=None, top=None):
>>
>> return '\n'.join(dump)
>>
>>+
>> def dump_gc(g):
>> gc = g['gc']
>> stats = ['{key}: {value}'.format(key=f, value=gc[f]) for f in (
>>@@ -530,6 +594,7 @@ class LJBase(gdb.Command):
>> gdb.Command.__init__(self, name, gdb.COMMAND_DATA)
>> gdb.write('{} command initialized\n'.format(name))
>>
>>+
>> class LJDumpArch(LJBase):
>> '''
>> lj-arch
>>@@ -549,6 +614,7 @@ pointers respectively.
>> )
>> )
>>
>>+
>> class LJDumpTValue(LJBase):
>> '''
>> lj-tv <TValue *>
>>@@ -582,6 +648,7 @@ error message occurs.
>> tv = cast('TValue *', parse_arg(arg))
>> gdb.write('{}\n'.format(dump_tvalue(tv)))
>>
>>+
>> class LJDumpString(LJBase):
>> '''
>> lj-str <GCstr *>
>>@@ -601,6 +668,7 @@ is replaced with the corresponding error when decoding fails.
>> len=string['len'],
>> ))
>>
>>+
>> class LJDumpTable(LJBase):
>> '''
>> lj-tab <GCtab *>
>>@@ -646,6 +714,7 @@ The command receives a GCtab adress and dumps the table contents:
>> n=mref('struct Node *', node['next'])
>> ))
>>
>>+
>> class LJDumpStack(LJBase):
>> '''
>> lj-stack [<lua_State *>]
>>@@ -682,6 +751,7 @@ If L is ommited the main coroutine is used.
>> def invoke(self, arg, from_tty):
>> gdb.write('{}\n'.format(dump_stack(L(parse_arg(arg)))))
>>
>>+
>> class LJState(LJBase):
>> '''
>> lj-state
>>@@ -701,6 +771,7 @@ The command requires no args and dumps current VM and GC states
>> }.items())
>> )))
>>
>>+
>> class LJGC(LJBase):
>> '''
>> lj-gc
>>@@ -727,6 +798,7 @@ The command requires no args and dumps current GC stats:
>> stats=dump_gc(g)
>> ))
>>
>>+
>> def init(commands):
>> global LJ_64, LJ_GC64, LJ_FR2, LJ_DUALNUM, LJ_TISNUM, PADDING
>>
>>@@ -783,6 +855,7 @@ def init(commands):
>>
>> gdb.write('luajit-gdb.py is successfully loaded\n')
>>
>>+
>> def load(event=None):
>> init({
>> 'lj-arch': LJDumpArch,
>>diff --git a/src/luajit_lldb.py b/src/luajit_lldb.py
>>index b62705c3..bd8353d5 100644
>>--- a/src/luajit_lldb.py
>>+++ b/src/luajit_lldb.py
>>@@ -21,6 +21,7 @@ LJ_TISNUM = None
>> # Global
>> target = None
>>
>>+
>> class Ptr:
>> def __init__(self, value, normal_type):
>> self.value = value
>>@@ -82,6 +83,7 @@ class Ptr:
>> return getattr(self.__deref, name)
>> return self.__deref
>>
>>+
>> class MetaStruct(type):
>> def __init__(cls, name, bases, nmspc):
>> super(MetaStruct, cls).__init__(name, bases, nmspc)
>>@@ -108,6 +110,7 @@ class MetaStruct(type):
>> property(make_general(field[1], field[0])),
>> )
>>
>>+
>> class Struct(metaclass=MetaStruct):
>> def __init__(self, value):
>> self.value = value
>>@@ -274,6 +277,7 @@ class Command(object):
>> automatically transformed into proper errors.
>> """
>>
>>+
>> def cast(typename, value):
>> pointer_type = False
>> name = None
>>@@ -321,31 +325,39 @@ def cast(typename, value):
>> else:
>> return casted
>>
>>+
>> def lookup_global(name):
>> return target.FindFirstGlobalVariable(name)
>>
>>+
>> def type_member(type_obj, name):
>> return next((x for x in type_obj.members if x.name == name), None)
>>
>>+
>> def find_type(typename):
>> return target.FindFirstType(typename)
>>
>>+
>> def offsetof(typename, membername):
>> type_obj = find_type(typename)
>> member = type_member(type_obj, membername)
>> assert member is not None
>> return member.GetOffsetInBytes()
>>
>>+
>> def sizeof(typename):
>> type_obj = find_type(typename)
>> return type_obj.GetByteSize()
>>
>>+
>> def vtou64(value):
>> return value.unsigned & 0xFFFFFFFFFFFFFFFF
>>
>>+
>> def vtoi(value):
>> return value.signed
>>
>>+
>> def dbg_eval(expr):
>> process = target.GetProcess()
>> thread = process.GetSelectedThread()
>>@@ -354,17 +366,21 @@ def dbg_eval(expr):
>>
>> # }}} Debugger specific
>>
>>+
>> def gcval(obj):
>> return cast(GCobjPtr, cast('uintptr_t', obj.gcptr & LJ_GCVMASK) if LJ_GC64
>> else cast('uintptr_t', obj.gcptr))
>>
>>+
>> def gcref(obj):
>> return cast(GCobjPtr, obj.gcptr if LJ_GC64
>> else cast('uintptr_t', obj.gcptr))
>>
>>+
>> def gcnext(obj):
>> return gcref(obj).gch.nextgc
>>
>>+
>> def gclistlen(root, end=0x0):
>> count = 0
>> while(gcref(root) != end):
>>@@ -372,6 +388,7 @@ def gclistlen(root, end=0x0):
>> root = gcnext(root)
>> return count
>>
>>+
>> def gcringlen(root):
>> if not gcref(root):
>> return 0
>>@@ -389,6 +406,7 @@ gclen = {
>> 'mmudata': gcringlen,
>> }
>>
>>+
>> def dump_gc(g):
>> gc = g.gc
>> stats = ['{key}: {value}'.format(key=f, value=getattr(gc, f)) for f in (
>>@@ -407,9 +425,11 @@ def dump_gc(g):
>> ) for stat, handler in gclen.items()]
>> return '\n'.join(map(lambda s: '\t' + s, stats))
>>
>>+
>> def mref(typename, obj):
>> return cast(typename, obj.ptr)
>>
>>+
>> def J(g):
>> g_offset = offsetof('GG_State', 'g')
>> J_offset = offsetof('GG_State', 'J')
>>@@ -418,9 +438,11 @@ def J(g):
>> vtou64(cast('char *', g)) - g_offset + J_offset,
>> )
>>
>>+
>> def G(L):
>> return mref(global_StatePtr, L.glref)
>>
>>+
>> 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
>>@@ -435,12 +457,15 @@ def L(L=None):
>> if l:
>> return lua_State(l)
>>
>>+
>> def tou32(val):
>> return val & 0xFFFFFFFF
>>
>>+
>> def i2notu32(val):
>> return ~int(val) & 0xFFFFFFFF
>>
>>+
>> def vm_state(g):
>> return {
>> i2notu32(0): 'INTERP',
>>@@ -454,6 +479,7 @@ def vm_state(g):
>> i2notu32(8): 'ASM',
>> }.get(int(tou32(g.vmstate)), 'TRACE')
>>
>>+
>> def gc_state(g):
>> return {
>> 0: 'PAUSE',
>>@@ -465,6 +491,7 @@ def gc_state(g):
>> 6: 'LAST',
>> }.get(g.gc.state, 'INVALID')
>>
>>+
>> def jit_state(g):
>> return {
>> 0: 'IDLE',
>>@@ -476,16 +503,19 @@ def jit_state(g):
>> 0x15: 'ERR',
>> }.get(J(g).state, 'INVALID')
>>
>>+
>> def strx64(val):
>> return re.sub('L?$', '',
>> hex(int(val) & 0xFFFFFFFFFFFFFFFF))
>>
>>+
>> def funcproto(func):
>> assert(func.ffid == 0)
>> proto_size = sizeof('GCproto')
>> value = cast('uintptr_t', vtou64(mref('char *', func.pc)) - proto_size)
>> return cast(GCprotoPtr, value)
>>
>>+
>> def strdata(obj):
>> try:
>> ptr = cast('char *', obj + 1)
>>@@ -493,48 +523,61 @@ def strdata(obj):
>> except UnicodeEncodeError:
>> return "<luajit-lldb: error occured while rendering non-ascii slot>"
>>
>>+
>> def itype(o):
>> return tou32(o.it64 >> 47) if LJ_GC64 else o.it
>>
>>+
>> def tvisint(o):
>> return LJ_DUALNUM and itype(o) == LJ_TISNUM
>>
>>+
>> def tvislightud(o):
>> if LJ_64 and not LJ_GC64:
>> return (vtoi(cast('int32_t', itype(o))) >> 15) == -2
>> else:
>> return itype(o) == LJ_T['LIGHTUD']
>>
>>+
>> def tvisnumber(o):
>> return itype(o) <= LJ_TISNUM
>>
>>+
>> def dump_lj_tnil(tv):
>> return 'nil'
>>
>>+
>> def dump_lj_tfalse(tv):
>> return 'false'
>>
>>+
>> def dump_lj_ttrue(tv):
>> return 'true'
>>
>>+
>> def dump_lj_tlightud(tv):
>> return 'light userdata @ {}'.format(strx64(gcval(tv.gcr)))
>>
>>+
>> def dump_lj_tstr(tv):
>> return 'string {body} @ {address}'.format(
>> body=strdata(cast(GCstrPtr, gcval(tv.gcr))),
>> address=strx64(gcval(tv.gcr))
>> )
>>
>>+
>> def dump_lj_tupval(tv):
>> return 'upvalue @ {}'.format(strx64(gcval(tv.gcr)))
>>
>>+
>> def dump_lj_tthread(tv):
>> return 'thread @ {}'.format(strx64(gcval(tv.gcr)))
>>
>>+
>> def dump_lj_tproto(tv):
>> return 'proto @ {}'.format(strx64(gcval(tv.gcr)))
>>
>>+
>> def dump_lj_tfunc(tv):
>> func = cast(GCfuncCPtr, gcval(tv.gcr))
>> ffid = func.ffid
>>@@ -552,6 +595,7 @@ def dump_lj_tfunc(tv):
>> else:
>> return 'fast function #{}'.format(ffid)
>>
>>+
>> def dump_lj_ttrace(tv):
>> trace = cast(GCtracePtr, gcval(tv.gcr))
>> return 'trace {traceno} @ {addr}'.format(
>>@@ -559,9 +603,11 @@ def dump_lj_ttrace(tv):
>> addr=strx64(trace)
>> )
>>
>>+
>> def dump_lj_tcdata(tv):
>> return 'cdata @ {}'.format(strx64(gcval(tv.gcr)))
>>
>>+
>> def dump_lj_ttab(tv):
>> table = cast(GCtabPtr, gcval(tv.gcr))
>> return 'table @ {gcr} (asize: {asize}, hmask: {hmask})'.format(
>>@@ -570,15 +616,18 @@ def dump_lj_ttab(tv):
>> hmask=strx64(table.hmask),
>> )
>>
>>+
>> def dump_lj_tudata(tv):
>> return 'userdata @ {}'.format(strx64(gcval(tv.gcr)))
>>
>>+
>> def dump_lj_tnumx(tv):
>> if tvisint(tv):
>> return 'integer {}'.format(cast('int32_t', tv.i))
>> else:
>> return 'number {}'.format(tv.n)
>>
>>+
>> def dump_lj_invalid(tv):
>> return 'not valid type @ {}'.format(strx64(gcval(tv.gcr)))
>>
>>@@ -616,6 +665,7 @@ LJ_T = {
>> 'NUMX': i2notu32(13),
>> }
>>
>>+
>> def itypemap(o):
>> if LJ_64 and not LJ_GC64:
>> return LJ_T['NUMX'] if tvisnumber(o) \
>>@@ -623,11 +673,13 @@ def itypemap(o):
>> else:
>> return LJ_T['NUMX'] if tvisnumber(o) else itype(o)
>>
>>+
>> def typenames(value):
>> return {
>> LJ_T[k]: 'LJ_T' + k for k in LJ_T.keys()
>> }.get(int(value), 'LJ_TINVALID')
>>
>>+
>> def dump_tvalue(tvptr):
>> return dumpers.get(typenames(itypemap(tvptr)), dump_lj_invalid)(tvptr)
>>
>>@@ -646,6 +698,7 @@ FRAME = {
>> 'PCALLH': 0x7,
>> }
>>
>>+
>> def frametypes(ft):
>> return {
>> FRAME['LUA']: 'L',
>>@@ -654,17 +707,21 @@ def frametypes(ft):
>> FRAME['VARG']: 'V',
>> }.get(ft, '?')
>>
>>+
>> def bc_a(ins):
>> return (ins >> 8) & 0xff
>>
>>+
>> def frame_ftsz(framelink):
>> return vtou64(cast('ptrdiff_t', framelink.ftsz if LJ_FR2 \
>> else framelink.fr.tp.ftsz))
>>
>>+
>> def frame_pc(framelink):
>> return cast(BCInsPtr, frame_ftsz(framelink)) if LJ_FR2 \
>> else mref(BCInsPtr, framelink.fr.tp.pcr)
>>
>>+
>> def frame_prevl(framelink):
>> # We are evaluating the `frame_pc(framelink)[-1])` with lldb's
>> # REPL, because the lldb API is faulty and it's not possible to cast
>>@@ -673,32 +730,41 @@ def frame_prevl(framelink):
>> # a pointer to it.
>> return framelink - (1 + LJ_FR2 + bc_a(vtou64(dbg_eval('((BCIns *)' + str(frame_pc(framelink)) + ')[-1]'))))
>>
>>+
>> def frame_ispcall(framelink):
>> return (frame_ftsz(framelink) & FRAME['PCALL']) == FRAME['PCALL']
>>
>>+
>> def frame_sized(framelink):
>> return (frame_ftsz(framelink) & ~FRAME_TYPEP)
>>
>>+
>> def frame_prevd(framelink):
>> return framelink - int(frame_sized(framelink) / sizeof('TValue'))
>>
>>+
>> def frame_type(framelink):
>> return frame_ftsz(framelink) & FRAME_TYPE
>>
>>+
>> def frame_typep(framelink):
>> return frame_ftsz(framelink) & FRAME_TYPEP
>>
>>+
>> def frame_islua(framelink):
>> return frametypes(frame_type(framelink)) == 'L' \
>> and frame_ftsz(framelink) > 0
>>
>>+
>> def frame_prev(framelink):
>> return frame_prevl(framelink) if frame_islua(framelink) \
>> else frame_prevd(framelink)
>>
>>+
>> def frame_sentinel(L):
>> return mref(TValuePtr, L.stack) + LJ_FR2
>>
>>+
>> # The generator that implements frame iterator.
>> # Every frame is represented as a tuple of framelink and frametop.
>> def frames(L):
>>@@ -712,6 +778,7 @@ def frames(L):
>> break
>> framelink = frame_prev(framelink)
>>
>>+
>> def dump_framelink_slot_address(fr):
>> return '{start:{padding}}:{end:{padding}}'.format(
>> start=hex(int(fr - 1)),
>>@@ -722,6 +789,7 @@ def dump_framelink_slot_address(fr):
>> padding=len(PADDING),
>> )
>>
>>+
>> def dump_framelink(L, fr):
>> if fr == frame_sentinel(L):
>> return '{addr} [S ] FRAME: dummy L'.format(
>>@@ -737,6 +805,7 @@ def dump_framelink(L, fr):
>> f=dump_lj_tfunc(fr - LJ_FR2),
>> )
>>
>>+
>> def dump_stack_slot(L, slot, base=None, top=None):
>> base = base or L.base
>> top = top or L.top
>>@@ -750,6 +819,7 @@ def dump_stack_slot(L, slot, base=None, top=None):
>> value=dump_tvalue(slot),
>> )
>>
>>+
>> def dump_stack(L, base=None, top=None):
>> base = base or L.base
>> top = top or L.top
>>@@ -845,6 +915,7 @@ The command requires no args and dumps current VM and GC states
>> }.items())
>> )))
>>
>>+
>> class LJDumpArch(Command):
>> '''
>> lj-arch
>>@@ -863,6 +934,7 @@ pointers respectively.
>> )
>> )
>>
>>+
>> class LJGC(Command):
>> '''
>> lj-gc
>>@@ -888,6 +960,7 @@ The command requires no args and dumps current GC stats:
>> stats=dump_gc(g)
>> ))
>>
>>+
>> class LJDumpString(Command):
>> '''
>> lj-str <GCstr *>
>>@@ -906,6 +979,7 @@ is replaced with the corresponding error when decoding fails.
>> len=string_ptr.len,
>> ))
>>
>>+
>> class LJDumpTable(Command):
>> '''
>> lj-tab <GCtab *>
>>@@ -950,6 +1024,7 @@ The command receives a GCtab adress and dumps the table contents:
>> n=strx64(mref(NodePtr, node.next))
>> ))
>>
>>+
>> class LJDumpStack(Command):
>> '''
>> lj-stack [<lua_State *>]
>>@@ -999,6 +1074,7 @@ def register_commands(debugger, commands):
>> )
>> print('{cmd} command intialized'.format(cmd=cls.command))
>>
>>+
>> def configure(debugger):
>> global LJ_64, LJ_GC64, LJ_FR2, LJ_DUALNUM, PADDING, LJ_TISNUM, target
>> target = debugger.GetSelectedTarget()
>>--
>>2.30.2
>
[-- Attachment #2: Type: text/html, Size: 39365 bytes --]
^ permalink raw reply [flat|nested] 68+ messages in thread
* [Tarantool-patches] [PATCH luajit 09/15] test: fix E303 errors by pycodestyle
2023-08-03 7:30 [Tarantool-patches] [PATCH luajit 00/15] Add flake8 linter Igor Munkin via Tarantool-patches
` (7 preceding siblings ...)
2023-08-03 7:30 ` [Tarantool-patches] [PATCH luajit 08/15] test: fix E302 " Igor Munkin via Tarantool-patches
@ 2023-08-03 7:30 ` Igor Munkin via Tarantool-patches
2023-08-03 14:28 ` Sergey Bronnikov via Tarantool-patches
2023-08-03 16:03 ` Maxim Kokryashkin via Tarantool-patches
2023-08-03 7:30 ` [Tarantool-patches] [PATCH luajit 10/15] test: fix E305 " Igor Munkin via Tarantool-patches
` (6 subsequent siblings)
15 siblings, 2 replies; 68+ messages in thread
From: Igor Munkin via Tarantool-patches @ 2023-08-03 7:30 UTC (permalink / raw)
To: Maxim Kokryashkin, Sergey Bronnikov; +Cc: tarantool-patches
Fixed the only occurrence of E303 ("too many blank lines (2)") and two
occurrences of E303 ("too many blank lines (3)") errors reported by
pycodestyle[1].
[1]: https://www.flake8rules.com/rules/E303.html
Signed-off-by: Igor Munkin <imun@tarantool.org>
---
src/luajit_lldb.py | 3 ---
1 file changed, 3 deletions(-)
diff --git a/src/luajit_lldb.py b/src/luajit_lldb.py
index bd8353d5..bdd9e716 100644
--- a/src/luajit_lldb.py
+++ b/src/luajit_lldb.py
@@ -50,7 +50,6 @@ class Ptr:
else:
return int((self.value.unsigned - other.value.unsigned) / sizeof(self.normal_type.__name__))
-
def __eq__(self, other):
assert isinstance(other, Ptr) or (isinstance(other, int) and other >= 0)
if isinstance(other, Ptr):
@@ -896,7 +895,6 @@ error message occurs.
print('{}'.format(dump_tvalue(tvptr)))
-
class LJState(Command):
'''
lj-state
@@ -1097,7 +1095,6 @@ def configure(debugger):
LJ_TISNUM = 0xfffeffff if LJ_64 and not LJ_GC64 else LJ_T['NUMX']
-
def __lldb_init_module(debugger, internal_dict):
configure(debugger)
register_commands(debugger, {
--
2.30.2
^ permalink raw reply [flat|nested] 68+ messages in thread
* Re: [Tarantool-patches] [PATCH luajit 09/15] test: fix E303 errors by pycodestyle
2023-08-03 7:30 ` [Tarantool-patches] [PATCH luajit 09/15] test: fix E303 " Igor Munkin via Tarantool-patches
@ 2023-08-03 14:28 ` Sergey Bronnikov via Tarantool-patches
2023-08-03 16:03 ` Maxim Kokryashkin via Tarantool-patches
1 sibling, 0 replies; 68+ messages in thread
From: Sergey Bronnikov via Tarantool-patches @ 2023-08-03 14:28 UTC (permalink / raw)
To: Igor Munkin, Maxim Kokryashkin; +Cc: tarantool-patches
LGTM
On 8/3/23 10:30, Igor Munkin wrote:
> Fixed the only occurrence of E303 ("too many blank lines (2)") and two
> occurrences of E303 ("too many blank lines (3)") errors reported by
> pycodestyle[1].
>
> [1]: https://www.flake8rules.com/rules/E303.html
>
> Signed-off-by: Igor Munkin <imun@tarantool.org>
> ---
> src/luajit_lldb.py | 3 ---
> 1 file changed, 3 deletions(-)
>
> diff --git a/src/luajit_lldb.py b/src/luajit_lldb.py
> index bd8353d5..bdd9e716 100644
> --- a/src/luajit_lldb.py
> +++ b/src/luajit_lldb.py
> @@ -50,7 +50,6 @@ class Ptr:
> else:
> return int((self.value.unsigned - other.value.unsigned) / sizeof(self.normal_type.__name__))
>
> -
> def __eq__(self, other):
> assert isinstance(other, Ptr) or (isinstance(other, int) and other >= 0)
> if isinstance(other, Ptr):
> @@ -896,7 +895,6 @@ error message occurs.
> print('{}'.format(dump_tvalue(tvptr)))
>
>
> -
> class LJState(Command):
> '''
> lj-state
> @@ -1097,7 +1095,6 @@ def configure(debugger):
> LJ_TISNUM = 0xfffeffff if LJ_64 and not LJ_GC64 else LJ_T['NUMX']
>
>
> -
> def __lldb_init_module(debugger, internal_dict):
> configure(debugger)
> register_commands(debugger, {
^ permalink raw reply [flat|nested] 68+ messages in thread
* Re: [Tarantool-patches] [PATCH luajit 09/15] test: fix E303 errors by pycodestyle
2023-08-03 7:30 ` [Tarantool-patches] [PATCH luajit 09/15] test: fix E303 " Igor Munkin via Tarantool-patches
2023-08-03 14:28 ` Sergey Bronnikov via Tarantool-patches
@ 2023-08-03 16:03 ` Maxim Kokryashkin via Tarantool-patches
1 sibling, 0 replies; 68+ messages in thread
From: Maxim Kokryashkin via Tarantool-patches @ 2023-08-03 16:03 UTC (permalink / raw)
To: Igor Munkin; +Cc: tarantool-patches
[-- Attachment #1: Type: text/plain, Size: 1398 bytes --]
Hi, Igor!
Thanks for the patch!
LGTM
--
Best regards,
Maxim Kokryashkin
>
>>Fixed the only occurrence of E303 ("too many blank lines (2)") and two
>>occurrences of E303 ("too many blank lines (3)") errors reported by
>>pycodestyle[1].
>>
>>[1]: https://www.flake8rules.com/rules/E303.html
>>
>>Signed-off-by: Igor Munkin < imun@tarantool.org >
>>---
>> src/luajit_lldb.py | 3 ---
>> 1 file changed, 3 deletions(-)
>>
>>diff --git a/src/luajit_lldb.py b/src/luajit_lldb.py
>>index bd8353d5..bdd9e716 100644
>>--- a/src/luajit_lldb.py
>>+++ b/src/luajit_lldb.py
>>@@ -50,7 +50,6 @@ class Ptr:
>> else:
>> return int((self.value.unsigned - other.value.unsigned) / sizeof(self.normal_type.__name__))
>>
>>-
>> def __eq__(self, other):
>> assert isinstance(other, Ptr) or (isinstance(other, int) and other >= 0)
>> if isinstance(other, Ptr):
>>@@ -896,7 +895,6 @@ error message occurs.
>> print('{}'.format(dump_tvalue(tvptr)))
>>
>>
>>-
>> class LJState(Command):
>> '''
>> lj-state
>>@@ -1097,7 +1095,6 @@ def configure(debugger):
>> LJ_TISNUM = 0xfffeffff if LJ_64 and not LJ_GC64 else LJ_T['NUMX']
>>
>>
>>-
>> def __lldb_init_module(debugger, internal_dict):
>> configure(debugger)
>> register_commands(debugger, {
>>--
>>2.30.2
>
[-- Attachment #2: Type: text/html, Size: 2447 bytes --]
^ permalink raw reply [flat|nested] 68+ messages in thread
* [Tarantool-patches] [PATCH luajit 10/15] test: fix E305 errors by pycodestyle
2023-08-03 7:30 [Tarantool-patches] [PATCH luajit 00/15] Add flake8 linter Igor Munkin via Tarantool-patches
` (8 preceding siblings ...)
2023-08-03 7:30 ` [Tarantool-patches] [PATCH luajit 09/15] test: fix E303 " Igor Munkin via Tarantool-patches
@ 2023-08-03 7:30 ` Igor Munkin via Tarantool-patches
2023-08-03 14:28 ` Sergey Bronnikov via Tarantool-patches
2023-08-03 16:05 ` Maxim Kokryashkin via Tarantool-patches
2023-08-03 7:30 ` [Tarantool-patches] [PATCH luajit 11/15] test: fix E502 " Igor Munkin via Tarantool-patches
` (5 subsequent siblings)
15 siblings, 2 replies; 68+ messages in thread
From: Igor Munkin via Tarantool-patches @ 2023-08-03 7:30 UTC (permalink / raw)
To: Maxim Kokryashkin, Sergey Bronnikov; +Cc: tarantool-patches
Fixed 10 occurrences of E305 ("expected 2 blank lines after class or
function definition, found 1") error reported by pycodestyle[1].
Furthermore, some other spots have been re-aligned the similar way to be
in sync with the default code style.
[1]: https://www.flake8rules.com/rules/E305.html
Signed-off-by: Igor Munkin <imun@tarantool.org>
---
src/luajit-gdb.py | 15 +++++++++++++++
src/luajit_lldb.py | 10 ++++++++++
2 files changed, 25 insertions(+)
diff --git a/src/luajit-gdb.py b/src/luajit-gdb.py
index 9c51be0b..3babb1d5 100644
--- a/src/luajit-gdb.py
+++ b/src/luajit-gdb.py
@@ -7,6 +7,7 @@ import sys
# make script compatible with the ancient Python {{{
+
LEGACY = re.match(r'^2\.', sys.version)
if LEGACY:
@@ -14,8 +15,10 @@ if LEGACY:
int = long
range = xrange
+
# }}}
+
gtype_cache = {}
@@ -70,8 +73,10 @@ def strx64(val):
return re.sub('L?$', '',
hex(int(cast('uint64_t', val) & 0xFFFFFFFFFFFFFFFF)))
+
# Types {{{
+
LJ_T = {
'NIL': i2notu32(0),
'FALSE': i2notu32(1),
@@ -95,10 +100,12 @@ def typenames(value):
LJ_T[k]: 'LJ_T' + k for k in LJ_T.keys()
}.get(int(value), 'LJ_TINVALID')
+
# }}}
# Frames {{{
+
FRAME_TYPE = 0x3
FRAME_P = 0x4
FRAME_TYPEP = FRAME_TYPE | FRAME_P
@@ -175,10 +182,12 @@ def frame_prev(framelink):
def frame_sentinel(L):
return mref('TValue *', L['stack']) + LJ_FR2
+
# }}}
# Const {{{
+
LJ_64 = None
LJ_GC64 = None
LJ_FR2 = None
@@ -194,6 +203,7 @@ LJ_LIGHTUD_BITS_LO = 47 - LJ_LIGHTUD_BITS_SEG
LIGHTUD_SEG_MASK = (1 << LJ_LIGHTUD_BITS_SEG) - 1
LIGHTUD_LO_MASK = (1 << LJ_LIGHTUD_BITS_LO) - 1
+
# }}}
@@ -339,6 +349,7 @@ def gcringlen(root):
else:
return 1 + gclistlen(gcnext(root), gcref(root))
+
gclen = {
'root': gclistlen,
'gray': gclistlen,
@@ -374,6 +385,7 @@ def lightudV(tv):
else:
return gcval(tv['gcr'])
+
# Dumpers {{{
@@ -465,8 +477,10 @@ def dump_lj_tnumx(tv):
def dump_lj_invalid(tv):
return 'not valid type @ {}'.format(strx64(gcval(tv['gcr'])))
+
# }}}
+
dumpers = {
'LJ_TNIL': dump_lj_tnil,
'LJ_TFALSE': dump_lj_tfalse,
@@ -867,4 +881,5 @@ def load(event=None):
'lj-gc': LJGC,
})
+
load(None)
diff --git a/src/luajit_lldb.py b/src/luajit_lldb.py
index bdd9e716..325b40ec 100644
--- a/src/luajit_lldb.py
+++ b/src/luajit_lldb.py
@@ -18,6 +18,8 @@ LJ_GCVMASK = ((1 << 47) - 1)
LJ_TISNUM = None
# Debugger specific {{{
+
+
# Global
target = None
@@ -121,6 +123,7 @@ class Struct(metaclass=MetaStruct):
def addr(self):
return self.value.address_of
+
c_structs = {
'MRef': [
(property(lambda self: self['ptr64'].unsigned if LJ_GC64 else self['ptr32'].unsigned), 'ptr')
@@ -212,9 +215,11 @@ c_structs = {
'BCIns': []
}
+
for cls in c_structs.keys():
globals()[cls] = type(cls, (Struct, ), {'metainfo': c_structs[cls]})
+
for cls in Struct.__subclasses__():
ptr_name = cls.__name__ + 'Ptr'
@@ -363,6 +368,7 @@ def dbg_eval(expr):
frame = thread.GetSelectedFrame()
return frame.EvaluateExpression(expr)
+
# }}} Debugger specific
@@ -396,6 +402,7 @@ def gcringlen(root):
else:
return 1 + gclistlen(gcnext(root), gcref(root))
+
gclen = {
'root': gclistlen,
'gray': gclistlen,
@@ -630,6 +637,7 @@ def dump_lj_tnumx(tv):
def dump_lj_invalid(tv):
return 'not valid type @ {}'.format(strx64(gcval(tv.gcr)))
+
dumpers = {
'LJ_TNIL': dump_lj_tnil,
'LJ_TFALSE': dump_lj_tfalse,
@@ -647,6 +655,7 @@ dumpers = {
'LJ_TNUMX': dump_lj_tnumx,
}
+
LJ_T = {
'NIL': i2notu32(0),
'FALSE': i2notu32(1),
@@ -682,6 +691,7 @@ def typenames(value):
def dump_tvalue(tvptr):
return dumpers.get(typenames(itypemap(tvptr)), dump_lj_invalid)(tvptr)
+
FRAME_TYPE = 0x3
FRAME_P = 0x4
FRAME_TYPEP = FRAME_TYPE | FRAME_P
--
2.30.2
^ permalink raw reply [flat|nested] 68+ messages in thread
* Re: [Tarantool-patches] [PATCH luajit 10/15] test: fix E305 errors by pycodestyle
2023-08-03 7:30 ` [Tarantool-patches] [PATCH luajit 10/15] test: fix E305 " Igor Munkin via Tarantool-patches
@ 2023-08-03 14:28 ` Sergey Bronnikov via Tarantool-patches
2023-08-03 16:05 ` Maxim Kokryashkin via Tarantool-patches
1 sibling, 0 replies; 68+ messages in thread
From: Sergey Bronnikov via Tarantool-patches @ 2023-08-03 14:28 UTC (permalink / raw)
To: Igor Munkin, Maxim Kokryashkin; +Cc: tarantool-patches
LGTM
On 8/3/23 10:30, Igor Munkin wrote:
> Fixed 10 occurrences of E305 ("expected 2 blank lines after class or
> function definition, found 1") error reported by pycodestyle[1].
> Furthermore, some other spots have been re-aligned the similar way to be
> in sync with the default code style.
>
> [1]: https://www.flake8rules.com/rules/E305.html
>
> Signed-off-by: Igor Munkin <imun@tarantool.org>
> ---
> src/luajit-gdb.py | 15 +++++++++++++++
> src/luajit_lldb.py | 10 ++++++++++
> 2 files changed, 25 insertions(+)
>
> diff --git a/src/luajit-gdb.py b/src/luajit-gdb.py
> index 9c51be0b..3babb1d5 100644
> --- a/src/luajit-gdb.py
> +++ b/src/luajit-gdb.py
> @@ -7,6 +7,7 @@ import sys
>
> # make script compatible with the ancient Python {{{
>
> +
> LEGACY = re.match(r'^2\.', sys.version)
>
> if LEGACY:
> @@ -14,8 +15,10 @@ if LEGACY:
> int = long
> range = xrange
>
> +
> # }}}
>
> +
> gtype_cache = {}
>
>
> @@ -70,8 +73,10 @@ def strx64(val):
> return re.sub('L?$', '',
> hex(int(cast('uint64_t', val) & 0xFFFFFFFFFFFFFFFF)))
>
> +
> # Types {{{
>
> +
> LJ_T = {
> 'NIL': i2notu32(0),
> 'FALSE': i2notu32(1),
> @@ -95,10 +100,12 @@ def typenames(value):
> LJ_T[k]: 'LJ_T' + k for k in LJ_T.keys()
> }.get(int(value), 'LJ_TINVALID')
>
> +
> # }}}
>
> # Frames {{{
>
> +
> FRAME_TYPE = 0x3
> FRAME_P = 0x4
> FRAME_TYPEP = FRAME_TYPE | FRAME_P
> @@ -175,10 +182,12 @@ def frame_prev(framelink):
> def frame_sentinel(L):
> return mref('TValue *', L['stack']) + LJ_FR2
>
> +
> # }}}
>
> # Const {{{
>
> +
> LJ_64 = None
> LJ_GC64 = None
> LJ_FR2 = None
> @@ -194,6 +203,7 @@ LJ_LIGHTUD_BITS_LO = 47 - LJ_LIGHTUD_BITS_SEG
> LIGHTUD_SEG_MASK = (1 << LJ_LIGHTUD_BITS_SEG) - 1
> LIGHTUD_LO_MASK = (1 << LJ_LIGHTUD_BITS_LO) - 1
>
> +
> # }}}
>
>
> @@ -339,6 +349,7 @@ def gcringlen(root):
> else:
> return 1 + gclistlen(gcnext(root), gcref(root))
>
> +
> gclen = {
> 'root': gclistlen,
> 'gray': gclistlen,
> @@ -374,6 +385,7 @@ def lightudV(tv):
> else:
> return gcval(tv['gcr'])
>
> +
> # Dumpers {{{
>
>
> @@ -465,8 +477,10 @@ def dump_lj_tnumx(tv):
> def dump_lj_invalid(tv):
> return 'not valid type @ {}'.format(strx64(gcval(tv['gcr'])))
>
> +
> # }}}
>
> +
> dumpers = {
> 'LJ_TNIL': dump_lj_tnil,
> 'LJ_TFALSE': dump_lj_tfalse,
> @@ -867,4 +881,5 @@ def load(event=None):
> 'lj-gc': LJGC,
> })
>
> +
> load(None)
> diff --git a/src/luajit_lldb.py b/src/luajit_lldb.py
> index bdd9e716..325b40ec 100644
> --- a/src/luajit_lldb.py
> +++ b/src/luajit_lldb.py
> @@ -18,6 +18,8 @@ LJ_GCVMASK = ((1 << 47) - 1)
> LJ_TISNUM = None
>
> # Debugger specific {{{
> +
> +
> # Global
> target = None
>
> @@ -121,6 +123,7 @@ class Struct(metaclass=MetaStruct):
> def addr(self):
> return self.value.address_of
>
> +
> c_structs = {
> 'MRef': [
> (property(lambda self: self['ptr64'].unsigned if LJ_GC64 else self['ptr32'].unsigned), 'ptr')
> @@ -212,9 +215,11 @@ c_structs = {
> 'BCIns': []
> }
>
> +
> for cls in c_structs.keys():
> globals()[cls] = type(cls, (Struct, ), {'metainfo': c_structs[cls]})
>
> +
> for cls in Struct.__subclasses__():
> ptr_name = cls.__name__ + 'Ptr'
>
> @@ -363,6 +368,7 @@ def dbg_eval(expr):
> frame = thread.GetSelectedFrame()
> return frame.EvaluateExpression(expr)
>
> +
> # }}} Debugger specific
>
>
> @@ -396,6 +402,7 @@ def gcringlen(root):
> else:
> return 1 + gclistlen(gcnext(root), gcref(root))
>
> +
> gclen = {
> 'root': gclistlen,
> 'gray': gclistlen,
> @@ -630,6 +637,7 @@ def dump_lj_tnumx(tv):
> def dump_lj_invalid(tv):
> return 'not valid type @ {}'.format(strx64(gcval(tv.gcr)))
>
> +
> dumpers = {
> 'LJ_TNIL': dump_lj_tnil,
> 'LJ_TFALSE': dump_lj_tfalse,
> @@ -647,6 +655,7 @@ dumpers = {
> 'LJ_TNUMX': dump_lj_tnumx,
> }
>
> +
> LJ_T = {
> 'NIL': i2notu32(0),
> 'FALSE': i2notu32(1),
> @@ -682,6 +691,7 @@ def typenames(value):
> def dump_tvalue(tvptr):
> return dumpers.get(typenames(itypemap(tvptr)), dump_lj_invalid)(tvptr)
>
> +
> FRAME_TYPE = 0x3
> FRAME_P = 0x4
> FRAME_TYPEP = FRAME_TYPE | FRAME_P
^ permalink raw reply [flat|nested] 68+ messages in thread
* Re: [Tarantool-patches] [PATCH luajit 10/15] test: fix E305 errors by pycodestyle
2023-08-03 7:30 ` [Tarantool-patches] [PATCH luajit 10/15] test: fix E305 " Igor Munkin via Tarantool-patches
2023-08-03 14:28 ` Sergey Bronnikov via Tarantool-patches
@ 2023-08-03 16:05 ` Maxim Kokryashkin via Tarantool-patches
1 sibling, 0 replies; 68+ messages in thread
From: Maxim Kokryashkin via Tarantool-patches @ 2023-08-03 16:05 UTC (permalink / raw)
To: Igor Munkin; +Cc: tarantool-patches
[-- Attachment #1: Type: text/plain, Size: 4711 bytes --]
Hi, Igor!
Thanks for the patch!
LGTM
--
Best regards,
Maxim Kokryashkin
>
>>Fixed 10 occurrences of E305 ("expected 2 blank lines after class or
>>function definition, found 1") error reported by pycodestyle[1].
>>Furthermore, some other spots have been re-aligned the similar way to be
>>in sync with the default code style.
>>
>>[1]: https://www.flake8rules.com/rules/E305.html
>>
>>Signed-off-by: Igor Munkin < imun@tarantool.org >
>>---
>> src/luajit-gdb.py | 15 +++++++++++++++
>> src/luajit_lldb.py | 10 ++++++++++
>> 2 files changed, 25 insertions(+)
>>
>>diff --git a/src/luajit-gdb.py b/src/luajit-gdb.py
>>index 9c51be0b..3babb1d5 100644
>>--- a/src/luajit-gdb.py
>>+++ b/src/luajit-gdb.py
>>@@ -7,6 +7,7 @@ import sys
>>
>> # make script compatible with the ancient Python {{{
>>
>>+
>> LEGACY = re.match(r'^2\.', sys.version)
>>
>> if LEGACY:
>>@@ -14,8 +15,10 @@ if LEGACY:
>> int = long
>> range = xrange
>>
>>+
>> # }}}
>>
>>+
>> gtype_cache = {}
>>
>>
>>@@ -70,8 +73,10 @@ def strx64(val):
>> return re.sub('L?$', '',
>> hex(int(cast('uint64_t', val) & 0xFFFFFFFFFFFFFFFF)))
>>
>>+
>> # Types {{{
>>
>>+
>> LJ_T = {
>> 'NIL': i2notu32(0),
>> 'FALSE': i2notu32(1),
>>@@ -95,10 +100,12 @@ def typenames(value):
>> LJ_T[k]: 'LJ_T' + k for k in LJ_T.keys()
>> }.get(int(value), 'LJ_TINVALID')
>>
>>+
>> # }}}
>>
>> # Frames {{{
>>
>>+
>> FRAME_TYPE = 0x3
>> FRAME_P = 0x4
>> FRAME_TYPEP = FRAME_TYPE | FRAME_P
>>@@ -175,10 +182,12 @@ def frame_prev(framelink):
>> def frame_sentinel(L):
>> return mref('TValue *', L['stack']) + LJ_FR2
>>
>>+
>> # }}}
>>
>> # Const {{{
>>
>>+
>> LJ_64 = None
>> LJ_GC64 = None
>> LJ_FR2 = None
>>@@ -194,6 +203,7 @@ LJ_LIGHTUD_BITS_LO = 47 - LJ_LIGHTUD_BITS_SEG
>> LIGHTUD_SEG_MASK = (1 << LJ_LIGHTUD_BITS_SEG) - 1
>> LIGHTUD_LO_MASK = (1 << LJ_LIGHTUD_BITS_LO) - 1
>>
>>+
>> # }}}
>>
>>
>>@@ -339,6 +349,7 @@ def gcringlen(root):
>> else:
>> return 1 + gclistlen(gcnext(root), gcref(root))
>>
>>+
>> gclen = {
>> 'root': gclistlen,
>> 'gray': gclistlen,
>>@@ -374,6 +385,7 @@ def lightudV(tv):
>> else:
>> return gcval(tv['gcr'])
>>
>>+
>> # Dumpers {{{
>>
>>
>>@@ -465,8 +477,10 @@ def dump_lj_tnumx(tv):
>> def dump_lj_invalid(tv):
>> return 'not valid type @ {}'.format(strx64(gcval(tv['gcr'])))
>>
>>+
>> # }}}
>>
>>+
>> dumpers = {
>> 'LJ_TNIL': dump_lj_tnil,
>> 'LJ_TFALSE': dump_lj_tfalse,
>>@@ -867,4 +881,5 @@ def load(event=None):
>> 'lj-gc': LJGC,
>> })
>>
>>+
>> load(None)
>>diff --git a/src/luajit_lldb.py b/src/luajit_lldb.py
>>index bdd9e716..325b40ec 100644
>>--- a/src/luajit_lldb.py
>>+++ b/src/luajit_lldb.py
>>@@ -18,6 +18,8 @@ LJ_GCVMASK = ((1 << 47) - 1)
>> LJ_TISNUM = None
>>
>> # Debugger specific {{{
>>+
>>+
>> # Global
>> target = None
>>
>>@@ -121,6 +123,7 @@ class Struct(metaclass=MetaStruct):
>> def addr(self):
>> return self.value.address_of
>>
>>+
>> c_structs = {
>> 'MRef': [
>> (property(lambda self: self['ptr64'].unsigned if LJ_GC64 else self['ptr32'].unsigned), 'ptr')
>>@@ -212,9 +215,11 @@ c_structs = {
>> 'BCIns': []
>> }
>>
>>+
>> for cls in c_structs.keys():
>> globals()[cls] = type(cls, (Struct, ), {'metainfo': c_structs[cls]})
>>
>>+
>> for cls in Struct.__subclasses__():
>> ptr_name = cls.__name__ + 'Ptr'
>>
>>@@ -363,6 +368,7 @@ def dbg_eval(expr):
>> frame = thread.GetSelectedFrame()
>> return frame.EvaluateExpression(expr)
>>
>>+
>> # }}} Debugger specific
>>
>>
>>@@ -396,6 +402,7 @@ def gcringlen(root):
>> else:
>> return 1 + gclistlen(gcnext(root), gcref(root))
>>
>>+
>> gclen = {
>> 'root': gclistlen,
>> 'gray': gclistlen,
>>@@ -630,6 +637,7 @@ def dump_lj_tnumx(tv):
>> def dump_lj_invalid(tv):
>> return 'not valid type @ {}'.format(strx64(gcval(tv.gcr)))
>>
>>+
>> dumpers = {
>> 'LJ_TNIL': dump_lj_tnil,
>> 'LJ_TFALSE': dump_lj_tfalse,
>>@@ -647,6 +655,7 @@ dumpers = {
>> 'LJ_TNUMX': dump_lj_tnumx,
>> }
>>
>>+
>> LJ_T = {
>> 'NIL': i2notu32(0),
>> 'FALSE': i2notu32(1),
>>@@ -682,6 +691,7 @@ def typenames(value):
>> def dump_tvalue(tvptr):
>> return dumpers.get(typenames(itypemap(tvptr)), dump_lj_invalid)(tvptr)
>>
>>+
>> FRAME_TYPE = 0x3
>> FRAME_P = 0x4
>> FRAME_TYPEP = FRAME_TYPE | FRAME_P
>>--
>>2.30.2
>
[-- Attachment #2: Type: text/html, Size: 6889 bytes --]
^ permalink raw reply [flat|nested] 68+ messages in thread
* [Tarantool-patches] [PATCH luajit 11/15] test: fix E502 errors by pycodestyle
2023-08-03 7:30 [Tarantool-patches] [PATCH luajit 00/15] Add flake8 linter Igor Munkin via Tarantool-patches
` (9 preceding siblings ...)
2023-08-03 7:30 ` [Tarantool-patches] [PATCH luajit 10/15] test: fix E305 " Igor Munkin via Tarantool-patches
@ 2023-08-03 7:30 ` Igor Munkin via Tarantool-patches
2023-08-03 14:29 ` Sergey Bronnikov via Tarantool-patches
2023-08-03 16:06 ` Maxim Kokryashkin via Tarantool-patches
2023-08-03 7:30 ` [Tarantool-patches] [PATCH luajit 12/15] test: fix E711 " Igor Munkin via Tarantool-patches
` (4 subsequent siblings)
15 siblings, 2 replies; 68+ messages in thread
From: Igor Munkin via Tarantool-patches @ 2023-08-03 7:30 UTC (permalink / raw)
To: Maxim Kokryashkin, Sergey Bronnikov; +Cc: tarantool-patches
Fixed two occurrences of E502 ("the backslash is redundant between
brackets") error reported by pycodestyle[1].
[1]: https://www.flake8rules.com/rules/E502.html
Signed-off-by: Igor Munkin <imun@tarantool.org>
---
src/luajit-gdb.py | 2 +-
src/luajit_lldb.py | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/luajit-gdb.py b/src/luajit-gdb.py
index 3babb1d5..8e786528 100644
--- a/src/luajit-gdb.py
+++ b/src/luajit-gdb.py
@@ -136,7 +136,7 @@ def bc_a(ins):
def frame_ftsz(framelink):
- return cast('ptrdiff_t', framelink['ftsz'] if LJ_FR2 \
+ return cast('ptrdiff_t', framelink['ftsz'] if LJ_FR2
else framelink['fr']['tp']['ftsz'])
diff --git a/src/luajit_lldb.py b/src/luajit_lldb.py
index 325b40ec..1442e367 100644
--- a/src/luajit_lldb.py
+++ b/src/luajit_lldb.py
@@ -722,7 +722,7 @@ def bc_a(ins):
def frame_ftsz(framelink):
- return vtou64(cast('ptrdiff_t', framelink.ftsz if LJ_FR2 \
+ return vtou64(cast('ptrdiff_t', framelink.ftsz if LJ_FR2
else framelink.fr.tp.ftsz))
--
2.30.2
^ permalink raw reply [flat|nested] 68+ messages in thread
* Re: [Tarantool-patches] [PATCH luajit 11/15] test: fix E502 errors by pycodestyle
2023-08-03 7:30 ` [Tarantool-patches] [PATCH luajit 11/15] test: fix E502 " Igor Munkin via Tarantool-patches
@ 2023-08-03 14:29 ` Sergey Bronnikov via Tarantool-patches
2023-08-03 16:06 ` Maxim Kokryashkin via Tarantool-patches
1 sibling, 0 replies; 68+ messages in thread
From: Sergey Bronnikov via Tarantool-patches @ 2023-08-03 14:29 UTC (permalink / raw)
To: Igor Munkin, Maxim Kokryashkin; +Cc: tarantool-patches
LGTM
On 8/3/23 10:30, Igor Munkin wrote:
> Fixed two occurrences of E502 ("the backslash is redundant between
> brackets") error reported by pycodestyle[1].
>
> [1]: https://www.flake8rules.com/rules/E502.html
>
> Signed-off-by: Igor Munkin <imun@tarantool.org>
> ---
> src/luajit-gdb.py | 2 +-
> src/luajit_lldb.py | 2 +-
> 2 files changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/src/luajit-gdb.py b/src/luajit-gdb.py
> index 3babb1d5..8e786528 100644
> --- a/src/luajit-gdb.py
> +++ b/src/luajit-gdb.py
> @@ -136,7 +136,7 @@ def bc_a(ins):
>
>
> def frame_ftsz(framelink):
> - return cast('ptrdiff_t', framelink['ftsz'] if LJ_FR2 \
> + return cast('ptrdiff_t', framelink['ftsz'] if LJ_FR2
> else framelink['fr']['tp']['ftsz'])
>
>
> diff --git a/src/luajit_lldb.py b/src/luajit_lldb.py
> index 325b40ec..1442e367 100644
> --- a/src/luajit_lldb.py
> +++ b/src/luajit_lldb.py
> @@ -722,7 +722,7 @@ def bc_a(ins):
>
>
> def frame_ftsz(framelink):
> - return vtou64(cast('ptrdiff_t', framelink.ftsz if LJ_FR2 \
> + return vtou64(cast('ptrdiff_t', framelink.ftsz if LJ_FR2
> else framelink.fr.tp.ftsz))
>
>
^ permalink raw reply [flat|nested] 68+ messages in thread
* Re: [Tarantool-patches] [PATCH luajit 11/15] test: fix E502 errors by pycodestyle
2023-08-03 7:30 ` [Tarantool-patches] [PATCH luajit 11/15] test: fix E502 " Igor Munkin via Tarantool-patches
2023-08-03 14:29 ` Sergey Bronnikov via Tarantool-patches
@ 2023-08-03 16:06 ` Maxim Kokryashkin via Tarantool-patches
1 sibling, 0 replies; 68+ messages in thread
From: Maxim Kokryashkin via Tarantool-patches @ 2023-08-03 16:06 UTC (permalink / raw)
To: Igor Munkin; +Cc: tarantool-patches
[-- Attachment #1: Type: text/plain, Size: 1295 bytes --]
Hi, Igor!
Thanks for the patch!
LGTM
--
Best regards,
Maxim Kokryashkin
>
>>Fixed two occurrences of E502 ("the backslash is redundant between
>>brackets") error reported by pycodestyle[1].
>>
>>[1]: https://www.flake8rules.com/rules/E502.html
>>
>>Signed-off-by: Igor Munkin < imun@tarantool.org >
>>---
>> src/luajit-gdb.py | 2 +-
>> src/luajit_lldb.py | 2 +-
>> 2 files changed, 2 insertions(+), 2 deletions(-)
>>
>>diff --git a/src/luajit-gdb.py b/src/luajit-gdb.py
>>index 3babb1d5..8e786528 100644
>>--- a/src/luajit-gdb.py
>>+++ b/src/luajit-gdb.py
>>@@ -136,7 +136,7 @@ def bc_a(ins):
>>
>>
>> def frame_ftsz(framelink):
>>- return cast('ptrdiff_t', framelink['ftsz'] if LJ_FR2 \
>>+ return cast('ptrdiff_t', framelink['ftsz'] if LJ_FR2
>> else framelink['fr']['tp']['ftsz'])
>>
>>
>>diff --git a/src/luajit_lldb.py b/src/luajit_lldb.py
>>index 325b40ec..1442e367 100644
>>--- a/src/luajit_lldb.py
>>+++ b/src/luajit_lldb.py
>>@@ -722,7 +722,7 @@ def bc_a(ins):
>>
>>
>> def frame_ftsz(framelink):
>>- return vtou64(cast('ptrdiff_t', framelink.ftsz if LJ_FR2 \
>>+ return vtou64(cast('ptrdiff_t', framelink.ftsz if LJ_FR2
>> else framelink.fr.tp.ftsz))
>>
>>
>>--
>>2.30.2
>
[-- Attachment #2: Type: text/html, Size: 2205 bytes --]
^ permalink raw reply [flat|nested] 68+ messages in thread
* [Tarantool-patches] [PATCH luajit 12/15] test: fix E711 errors by pycodestyle
2023-08-03 7:30 [Tarantool-patches] [PATCH luajit 00/15] Add flake8 linter Igor Munkin via Tarantool-patches
` (10 preceding siblings ...)
2023-08-03 7:30 ` [Tarantool-patches] [PATCH luajit 11/15] test: fix E502 " Igor Munkin via Tarantool-patches
@ 2023-08-03 7:30 ` Igor Munkin via Tarantool-patches
2023-08-03 14:29 ` Sergey Bronnikov via Tarantool-patches
2023-08-03 16:06 ` Maxim Kokryashkin via Tarantool-patches
2023-08-03 7:30 ` [Tarantool-patches] [PATCH luajit 13/15] test: fix E722 " Igor Munkin via Tarantool-patches
` (3 subsequent siblings)
15 siblings, 2 replies; 68+ messages in thread
From: Igor Munkin via Tarantool-patches @ 2023-08-03 7:30 UTC (permalink / raw)
To: Maxim Kokryashkin, Sergey Bronnikov; +Cc: tarantool-patches
Fixed the only occurrence of E711 ("comparison to None should be 'if
cond is not None:'") error reported by pycodestyle[1].
[1]: https://www.flake8rules.com/rules/E711.html
Signed-off-by: Igor Munkin <imun@tarantool.org>
---
src/luajit_lldb.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/luajit_lldb.py b/src/luajit_lldb.py
index 1442e367..e481cfa0 100644
--- a/src/luajit_lldb.py
+++ b/src/luajit_lldb.py
@@ -1087,7 +1087,7 @@ def configure(debugger):
global LJ_64, LJ_GC64, LJ_FR2, LJ_DUALNUM, PADDING, LJ_TISNUM, target
target = debugger.GetSelectedTarget()
module = target.modules[0]
- LJ_DUALNUM = module.FindSymbol('lj_lib_checknumber') != None
+ LJ_DUALNUM = module.FindSymbol('lj_lib_checknumber') is not None
try:
irtype_enum = target.FindFirstType('IRType').enum_members
--
2.30.2
^ permalink raw reply [flat|nested] 68+ messages in thread
* Re: [Tarantool-patches] [PATCH luajit 12/15] test: fix E711 errors by pycodestyle
2023-08-03 7:30 ` [Tarantool-patches] [PATCH luajit 12/15] test: fix E711 " Igor Munkin via Tarantool-patches
@ 2023-08-03 14:29 ` Sergey Bronnikov via Tarantool-patches
2023-08-03 16:06 ` Maxim Kokryashkin via Tarantool-patches
1 sibling, 0 replies; 68+ messages in thread
From: Sergey Bronnikov via Tarantool-patches @ 2023-08-03 14:29 UTC (permalink / raw)
To: Igor Munkin, Maxim Kokryashkin; +Cc: tarantool-patches
LGTM
On 8/3/23 10:30, Igor Munkin wrote:
> Fixed the only occurrence of E711 ("comparison to None should be 'if
> cond is not None:'") error reported by pycodestyle[1].
>
> [1]: https://www.flake8rules.com/rules/E711.html
>
> Signed-off-by: Igor Munkin <imun@tarantool.org>
> ---
> src/luajit_lldb.py | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/src/luajit_lldb.py b/src/luajit_lldb.py
> index 1442e367..e481cfa0 100644
> --- a/src/luajit_lldb.py
> +++ b/src/luajit_lldb.py
> @@ -1087,7 +1087,7 @@ def configure(debugger):
> global LJ_64, LJ_GC64, LJ_FR2, LJ_DUALNUM, PADDING, LJ_TISNUM, target
> target = debugger.GetSelectedTarget()
> module = target.modules[0]
> - LJ_DUALNUM = module.FindSymbol('lj_lib_checknumber') != None
> + LJ_DUALNUM = module.FindSymbol('lj_lib_checknumber') is not None
>
> try:
> irtype_enum = target.FindFirstType('IRType').enum_members
^ permalink raw reply [flat|nested] 68+ messages in thread
* Re: [Tarantool-patches] [PATCH luajit 12/15] test: fix E711 errors by pycodestyle
2023-08-03 7:30 ` [Tarantool-patches] [PATCH luajit 12/15] test: fix E711 " Igor Munkin via Tarantool-patches
2023-08-03 14:29 ` Sergey Bronnikov via Tarantool-patches
@ 2023-08-03 16:06 ` Maxim Kokryashkin via Tarantool-patches
1 sibling, 0 replies; 68+ messages in thread
From: Maxim Kokryashkin via Tarantool-patches @ 2023-08-03 16:06 UTC (permalink / raw)
To: Igor Munkin; +Cc: tarantool-patches
[-- Attachment #1: Type: text/plain, Size: 1024 bytes --]
Hi, Igor!
Thanks for the patch!
LGTM
--
Best regards,
Maxim Kokryashkin
>
>>Fixed the only occurrence of E711 ("comparison to None should be 'if
>>cond is not None:'") error reported by pycodestyle[1].
>>
>>[1]: https://www.flake8rules.com/rules/E711.html
>>
>>Signed-off-by: Igor Munkin < imun@tarantool.org >
>>---
>> src/luajit_lldb.py | 2 +-
>> 1 file changed, 1 insertion(+), 1 deletion(-)
>>
>>diff --git a/src/luajit_lldb.py b/src/luajit_lldb.py
>>index 1442e367..e481cfa0 100644
>>--- a/src/luajit_lldb.py
>>+++ b/src/luajit_lldb.py
>>@@ -1087,7 +1087,7 @@ def configure(debugger):
>> global LJ_64, LJ_GC64, LJ_FR2, LJ_DUALNUM, PADDING, LJ_TISNUM, target
>> target = debugger.GetSelectedTarget()
>> module = target.modules[0]
>>- LJ_DUALNUM = module.FindSymbol('lj_lib_checknumber') != None
>>+ LJ_DUALNUM = module.FindSymbol('lj_lib_checknumber') is not None
>>
>> try:
>> irtype_enum = target.FindFirstType('IRType').enum_members
>>--
>>2.30.2
>
[-- Attachment #2: Type: text/html, Size: 1832 bytes --]
^ permalink raw reply [flat|nested] 68+ messages in thread
* [Tarantool-patches] [PATCH luajit 13/15] test: fix E722 errors by pycodestyle
2023-08-03 7:30 [Tarantool-patches] [PATCH luajit 00/15] Add flake8 linter Igor Munkin via Tarantool-patches
` (11 preceding siblings ...)
2023-08-03 7:30 ` [Tarantool-patches] [PATCH luajit 12/15] test: fix E711 " Igor Munkin via Tarantool-patches
@ 2023-08-03 7:30 ` Igor Munkin via Tarantool-patches
2023-08-03 14:29 ` Sergey Bronnikov via Tarantool-patches
2023-08-03 16:10 ` Maxim Kokryashkin via Tarantool-patches
2023-08-03 7:30 ` [Tarantool-patches] [PATCH luajit 14/15] test: fix E741 " Igor Munkin via Tarantool-patches
` (2 subsequent siblings)
15 siblings, 2 replies; 68+ messages in thread
From: Igor Munkin via Tarantool-patches @ 2023-08-03 7:30 UTC (permalink / raw)
To: Maxim Kokryashkin, Sergey Bronnikov; +Cc: tarantool-patches
Fixed 4 occurrences of E722 ("do not use bare 'except'") error reported
by pycodestyle[1]. Since no particular exception type should be handled,
the base Exception class is chosen.
[1]: https://www.flake8rules.com/rules/E722.html
Signed-off-by: Igor Munkin <imun@tarantool.org>
---
src/luajit-gdb.py | 6 +++---
src/luajit_lldb.py | 2 +-
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/src/luajit-gdb.py b/src/luajit-gdb.py
index 8e786528..a0c8f24e 100644
--- a/src/luajit-gdb.py
+++ b/src/luajit-gdb.py
@@ -838,14 +838,14 @@ def init(commands):
# Try to remove the callback at first to not append duplicates to
# gdb.events.new_objfile internal list.
disconnect(load)
- except:
+ except Exception:
# Callback is not connected.
pass
try:
# Detect whether libluajit objfile is loaded.
gdb.parse_and_eval('luaJIT_setmode')
- except:
+ except Exception:
gdb.write('luajit-gdb.py initialization is postponed '
'until libluajit objfile is loaded\n')
# Add a callback to be executed when the next objfile is loaded.
@@ -856,7 +856,7 @@ def init(commands):
LJ_64 = str(gdb.parse_and_eval('IRT_PTR')) == 'IRT_P64'
LJ_FR2 = LJ_GC64 = str(gdb.parse_and_eval('IRT_PGC')) == 'IRT_P64'
LJ_DUALNUM = gdb.lookup_global_symbol('lj_lib_checknumber') is not None
- except:
+ except Exception:
gdb.write('luajit-gdb.py failed to load: '
'no debugging symbols found for libluajit\n')
return
diff --git a/src/luajit_lldb.py b/src/luajit_lldb.py
index e481cfa0..4787c62c 100644
--- a/src/luajit_lldb.py
+++ b/src/luajit_lldb.py
@@ -1096,7 +1096,7 @@ def configure(debugger):
LJ_64 = member.unsigned & 0x1f == IRT_P64
if member.name == 'IRT_PGC':
LJ_FR2 = LJ_GC64 = member.unsigned & 0x1f == IRT_P64
- except:
+ except Exception:
print('luajit_lldb.py failed to load: '
'no debugging symbols found for libluajit')
return
--
2.30.2
^ permalink raw reply [flat|nested] 68+ messages in thread
* Re: [Tarantool-patches] [PATCH luajit 13/15] test: fix E722 errors by pycodestyle
2023-08-03 7:30 ` [Tarantool-patches] [PATCH luajit 13/15] test: fix E722 " Igor Munkin via Tarantool-patches
@ 2023-08-03 14:29 ` Sergey Bronnikov via Tarantool-patches
2023-08-03 16:10 ` Maxim Kokryashkin via Tarantool-patches
1 sibling, 0 replies; 68+ messages in thread
From: Sergey Bronnikov via Tarantool-patches @ 2023-08-03 14:29 UTC (permalink / raw)
To: Igor Munkin, Maxim Kokryashkin; +Cc: tarantool-patches
LGTM
On 8/3/23 10:30, Igor Munkin wrote:
> Fixed 4 occurrences of E722 ("do not use bare 'except'") error reported
> by pycodestyle[1]. Since no particular exception type should be handled,
> the base Exception class is chosen.
>
> [1]: https://www.flake8rules.com/rules/E722.html
>
> Signed-off-by: Igor Munkin <imun@tarantool.org>
> ---
> src/luajit-gdb.py | 6 +++---
> src/luajit_lldb.py | 2 +-
> 2 files changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/src/luajit-gdb.py b/src/luajit-gdb.py
> index 8e786528..a0c8f24e 100644
> --- a/src/luajit-gdb.py
> +++ b/src/luajit-gdb.py
> @@ -838,14 +838,14 @@ def init(commands):
> # Try to remove the callback at first to not append duplicates to
> # gdb.events.new_objfile internal list.
> disconnect(load)
> - except:
> + except Exception:
> # Callback is not connected.
> pass
>
> try:
> # Detect whether libluajit objfile is loaded.
> gdb.parse_and_eval('luaJIT_setmode')
> - except:
> + except Exception:
> gdb.write('luajit-gdb.py initialization is postponed '
> 'until libluajit objfile is loaded\n')
> # Add a callback to be executed when the next objfile is loaded.
> @@ -856,7 +856,7 @@ def init(commands):
> LJ_64 = str(gdb.parse_and_eval('IRT_PTR')) == 'IRT_P64'
> LJ_FR2 = LJ_GC64 = str(gdb.parse_and_eval('IRT_PGC')) == 'IRT_P64'
> LJ_DUALNUM = gdb.lookup_global_symbol('lj_lib_checknumber') is not None
> - except:
> + except Exception:
> gdb.write('luajit-gdb.py failed to load: '
> 'no debugging symbols found for libluajit\n')
> return
> diff --git a/src/luajit_lldb.py b/src/luajit_lldb.py
> index e481cfa0..4787c62c 100644
> --- a/src/luajit_lldb.py
> +++ b/src/luajit_lldb.py
> @@ -1096,7 +1096,7 @@ def configure(debugger):
> LJ_64 = member.unsigned & 0x1f == IRT_P64
> if member.name == 'IRT_PGC':
> LJ_FR2 = LJ_GC64 = member.unsigned & 0x1f == IRT_P64
> - except:
> + except Exception:
> print('luajit_lldb.py failed to load: '
> 'no debugging symbols found for libluajit')
> return
^ permalink raw reply [flat|nested] 68+ messages in thread
* Re: [Tarantool-patches] [PATCH luajit 13/15] test: fix E722 errors by pycodestyle
2023-08-03 7:30 ` [Tarantool-patches] [PATCH luajit 13/15] test: fix E722 " Igor Munkin via Tarantool-patches
2023-08-03 14:29 ` Sergey Bronnikov via Tarantool-patches
@ 2023-08-03 16:10 ` Maxim Kokryashkin via Tarantool-patches
1 sibling, 0 replies; 68+ messages in thread
From: Maxim Kokryashkin via Tarantool-patches @ 2023-08-03 16:10 UTC (permalink / raw)
To: Igor Munkin; +Cc: tarantool-patches
[-- Attachment #1: Type: text/plain, Size: 2534 bytes --]
Hi, Igor!
Thanks for the patch!
LGTM
--
Best regards,
Maxim Kokryashkin
>
>>Fixed 4 occurrences of E722 ("do not use bare 'except'") error reported
>>by pycodestyle[1]. Since no particular exception type should be handled,
>>the base Exception class is chosen.
>>
>>[1]: https://www.flake8rules.com/rules/E722.html
>>
>>Signed-off-by: Igor Munkin < imun@tarantool.org >
>>---
>> src/luajit-gdb.py | 6 +++---
>> src/luajit_lldb.py | 2 +-
>> 2 files changed, 4 insertions(+), 4 deletions(-)
>>
>>diff --git a/src/luajit-gdb.py b/src/luajit-gdb.py
>>index 8e786528..a0c8f24e 100644
>>--- a/src/luajit-gdb.py
>>+++ b/src/luajit-gdb.py
>>@@ -838,14 +838,14 @@ def init(commands):
>> # Try to remove the callback at first to not append duplicates to
>> # gdb.events.new_objfile internal list.
>> disconnect(load)
>>- except:
>>+ except Exception:
>> # Callback is not connected.
>> pass
>>
>> try:
>> # Detect whether libluajit objfile is loaded.
>> gdb.parse_and_eval('luaJIT_setmode')
>>- except:
>>+ except Exception:
>> gdb.write('luajit-gdb.py initialization is postponed '
>> 'until libluajit objfile is loaded\n')
>> # Add a callback to be executed when the next objfile is loaded.
>>@@ -856,7 +856,7 @@ def init(commands):
>> LJ_64 = str(gdb.parse_and_eval('IRT_PTR')) == 'IRT_P64'
>> LJ_FR2 = LJ_GC64 = str(gdb.parse_and_eval('IRT_PGC')) == 'IRT_P64'
>> LJ_DUALNUM = gdb.lookup_global_symbol('lj_lib_checknumber') is not None
>>- except:
>>+ except Exception:
>> gdb.write('luajit-gdb.py failed to load: '
>> 'no debugging symbols found for libluajit\n')
>> return
>>diff --git a/src/luajit_lldb.py b/src/luajit_lldb.py
>>index e481cfa0..4787c62c 100644
>>--- a/src/luajit_lldb.py
>>+++ b/src/luajit_lldb.py
>>@@ -1096,7 +1096,7 @@ def configure(debugger):
>> LJ_64 = member.unsigned & 0x1f == IRT_P64
>> if member.name == 'IRT_PGC':
>> LJ_FR2 = LJ_GC64 = member.unsigned & 0x1f == IRT_P64
>>- except:
>>+ except Exception:
>> print('luajit_lldb.py failed to load: '
>> 'no debugging symbols found for libluajit')
>> return
>>--
>>2.30.2
>
[-- Attachment #2: Type: text/html, Size: 4266 bytes --]
^ permalink raw reply [flat|nested] 68+ messages in thread
* [Tarantool-patches] [PATCH luajit 14/15] test: fix E741 errors by pycodestyle
2023-08-03 7:30 [Tarantool-patches] [PATCH luajit 00/15] Add flake8 linter Igor Munkin via Tarantool-patches
` (12 preceding siblings ...)
2023-08-03 7:30 ` [Tarantool-patches] [PATCH luajit 13/15] test: fix E722 " Igor Munkin via Tarantool-patches
@ 2023-08-03 7:30 ` Igor Munkin via Tarantool-patches
2023-08-03 14:34 ` Sergey Bronnikov via Tarantool-patches
2023-08-03 16:15 ` Maxim Kokryashkin via Tarantool-patches
2023-08-03 7:30 ` [Tarantool-patches] [PATCH luajit 15/15] test: run flake8 static analysis via CMake Igor Munkin via Tarantool-patches
2023-08-21 11:05 ` [Tarantool-patches] [PATCH luajit 00/15] Add flake8 linter Igor Munkin via Tarantool-patches
15 siblings, 2 replies; 68+ messages in thread
From: Igor Munkin via Tarantool-patches @ 2023-08-03 7:30 UTC (permalink / raw)
To: Maxim Kokryashkin, Sergey Bronnikov; +Cc: tarantool-patches
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@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), (
# 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):
--
2.30.2
^ permalink raw reply [flat|nested] 68+ messages in thread
* Re: [Tarantool-patches] [PATCH luajit 14/15] test: fix E741 errors by pycodestyle
2023-08-03 7:30 ` [Tarantool-patches] [PATCH luajit 14/15] test: fix E741 " Igor Munkin via Tarantool-patches
@ 2023-08-03 14:34 ` Sergey Bronnikov via Tarantool-patches
2023-08-07 11:00 ` Igor Munkin via Tarantool-patches
2023-08-03 16:15 ` Maxim Kokryashkin via Tarantool-patches
1 sibling, 1 reply; 68+ messages in thread
From: Sergey Bronnikov via Tarantool-patches @ 2023-08-03 14:34 UTC (permalink / raw)
To: Igor Munkin, Maxim Kokryashkin; +Cc: tarantool-patches
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@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):
^ permalink raw reply [flat|nested] 68+ messages in thread
* Re: [Tarantool-patches] [PATCH luajit 14/15] test: fix E741 errors by pycodestyle
2023-08-03 14:34 ` Sergey Bronnikov via Tarantool-patches
@ 2023-08-07 11:00 ` Igor Munkin via Tarantool-patches
2023-08-07 13:45 ` Sergey Bronnikov via Tarantool-patches
0 siblings, 1 reply; 68+ messages in thread
From: Igor Munkin via Tarantool-patches @ 2023-08-07 11:00 UTC (permalink / raw)
To: Sergey Bronnikov; +Cc: tarantool-patches
Sergey,
Thanks for your review!
On 03.08.23, Sergey Bronnikov wrote:
> 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@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
It's quite clear (at least for me): lua_State represents Lua coroutine
within low level space. However, I've already fixed it to "lstate" as
Max suggested (you can find the incremental diff in my reply).
>
>
> > # 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):
<snipped>
--
Best regards,
IM
^ permalink raw reply [flat|nested] 68+ messages in thread
* Re: [Tarantool-patches] [PATCH luajit 14/15] test: fix E741 errors by pycodestyle
2023-08-07 11:00 ` Igor Munkin via Tarantool-patches
@ 2023-08-07 13:45 ` Sergey Bronnikov via Tarantool-patches
0 siblings, 0 replies; 68+ messages in thread
From: Sergey Bronnikov via Tarantool-patches @ 2023-08-07 13:45 UTC (permalink / raw)
To: Igor Munkin; +Cc: tarantool-patches
Igor,
On 8/7/23 14:00, Igor Munkin wrote:
<snipped>
>>> 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
> It's quite clear (at least for me): lua_State represents Lua coroutine
> within low level space. However, I've already fixed it to "lstate" as
> Max suggested (you can find the incremental diff in my reply).
>
>
Thanks for explanation! LGTM now
^ permalink raw reply [flat|nested] 68+ messages in thread
* Re: [Tarantool-patches] [PATCH luajit 14/15] test: fix E741 errors by pycodestyle
2023-08-03 7:30 ` [Tarantool-patches] [PATCH luajit 14/15] test: fix E741 " Igor Munkin via Tarantool-patches
2023-08-03 14:34 ` Sergey Bronnikov via Tarantool-patches
@ 2023-08-03 16:15 ` Maxim Kokryashkin via Tarantool-patches
2023-08-07 10:57 ` Igor Munkin via Tarantool-patches
1 sibling, 1 reply; 68+ messages in thread
From: Maxim Kokryashkin via Tarantool-patches @ 2023-08-03 16:15 UTC (permalink / raw)
To: Igor Munkin; +Cc: tarantool-patches
[-- Attachment #1: Type: text/plain, Size: 2840 bytes --]
Hi, Igor!
Thanks for the patch!
I don’t think `coroutine` is a great name.`lua_state` seems
to be a better option here.
--
Best regards,
Maxim Kokryashkin
>Четверг, 3 августа 2023, 10:44 +03:00 от Igor Munkin <imun@tarantool.org>:
>
>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@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), (
> # 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):
>--
>2.30.2
[-- Attachment #2: Type: text/html, Size: 4165 bytes --]
^ permalink raw reply [flat|nested] 68+ messages in thread
* Re: [Tarantool-patches] [PATCH luajit 14/15] test: fix E741 errors by pycodestyle
2023-08-03 16:15 ` Maxim Kokryashkin via Tarantool-patches
@ 2023-08-07 10:57 ` Igor Munkin via Tarantool-patches
2023-08-13 20:25 ` Maxim Kokryashkin via Tarantool-patches
0 siblings, 1 reply; 68+ messages in thread
From: Igor Munkin via Tarantool-patches @ 2023-08-07 10:57 UTC (permalink / raw)
To: Maxim Kokryashkin; +Cc: tarantool-patches
Max,
Thanks for your review! For me it's totally the same (you can see I use
the term 'coro' in the comments right there), but I don't mind your
naming, so fixed. Here is the diff:
================================================================================
diff --git a/src/luajit-gdb.py b/src/luajit-gdb.py
index 2e0b145b..9075e99f 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 coroutine in [L] + list(map(lambda main: lookup(main), (
+ for lstate in [L] + list(map(lambda main: lookup(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 coroutine:
- return cast('lua_State *', coroutine)
+ if lstate:
+ return cast('lua_State *', lstate)
def G(L):
diff --git a/src/luajit_lldb.py b/src/luajit_lldb.py
index 76fb3141..85c0dcb9 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 coroutine in [L] + list(map(lambda main: lookup_global(main), (
+ for lstate 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 coroutine:
- return lua_State(coroutine)
+ if lstate:
+ return lua_State(lstate)
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):
- coro = self.parse(args)
- coro_ptr = cast('lua_State *', coro) if coro is not None else None
- print('{}'.format(dump_stack(L(coro_ptr))))
+ lstate = self.parse(args)
+ lstate_ptr = cast('lua_State *', lstate) if coro is not None else None
+ print('{}'.format(dump_stack(L(lstate_ptr))))
def register_commands(debugger, commands):
================================================================================
On 03.08.23, Maxim Kokryashkin wrote:
>
> Hi, Igor!
> Thanks for the patch!
> I don’t think `coroutine` is a great name.`lua_state` seems
> to be a better option here.
> --
> Best regards,
> Maxim Kokryashkin
>
>
<snipped>
>
--
Best regards,
IM
^ permalink raw reply [flat|nested] 68+ messages in thread
* Re: [Tarantool-patches] [PATCH luajit 14/15] test: fix E741 errors by pycodestyle
2023-08-07 10:57 ` Igor Munkin via Tarantool-patches
@ 2023-08-13 20:25 ` Maxim Kokryashkin via Tarantool-patches
0 siblings, 0 replies; 68+ messages in thread
From: Maxim Kokryashkin via Tarantool-patches @ 2023-08-13 20:25 UTC (permalink / raw)
To: Igor Munkin; +Cc: tarantool-patches
[-- Attachment #1: Type: text/plain, Size: 3101 bytes --]
Hi!
Thanks for the fix!
LGTM
--
Best regards,
Maxim Kokryashkin
>
>>Max,
>>
>>Thanks for your review! For me it's totally the same (you can see I use
>>the term 'coro' in the comments right there), but I don't mind your
>>naming, so fixed. Here is the diff:
>>
>>================================================================================
>>
>>diff --git a/src/luajit-gdb.py b/src/luajit-gdb.py
>>index 2e0b145b..9075e99f 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 coroutine in [L] + list(map(lambda main: lookup(main), (
>>+ for lstate in [L] + list(map(lambda main: lookup(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 coroutine:
>>- return cast('lua_State *', coroutine)
>>+ if lstate:
>>+ return cast('lua_State *', lstate)
>>
>>
>> def G(L):
>>diff --git a/src/luajit_lldb.py b/src/luajit_lldb.py
>>index 76fb3141..85c0dcb9 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 coroutine in [L] + list(map(lambda main: lookup_global(main), (
>>+ for lstate 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 coroutine:
>>- return lua_State(coroutine)
>>+ if lstate:
>>+ return lua_State(lstate)
>>
>>
>> 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):
>>- coro = self.parse(args)
>>- coro_ptr = cast('lua_State *', coro) if coro is not None else None
>>- print('{}'.format(dump_stack(L(coro_ptr))))
>>+ lstate = self.parse(args)
>>+ lstate_ptr = cast('lua_State *', lstate) if coro is not None else None
>>+ print('{}'.format(dump_stack(L(lstate_ptr))))
>>
>>
>> def register_commands(debugger, commands):
>>
>>================================================================================
>>
>>On 03.08.23, Maxim Kokryashkin wrote:
>>>
>>> Hi, Igor!
>>> Thanks for the patch!
>>> I don’t think `coroutine` is a great name.`lua_state` seems
>>> to be a better option here.
>>> --
>>> Best regards,
>>> Maxim Kokryashkin
>>>
>>>
>>
>><snipped>
>>
>>>
>>
>>--
>>Best regards,
>>IM
>
[-- Attachment #2: Type: text/html, Size: 4378 bytes --]
^ permalink raw reply [flat|nested] 68+ messages in thread
* [Tarantool-patches] [PATCH luajit 15/15] test: run flake8 static analysis via CMake
2023-08-03 7:30 [Tarantool-patches] [PATCH luajit 00/15] Add flake8 linter Igor Munkin via Tarantool-patches
` (13 preceding siblings ...)
2023-08-03 7:30 ` [Tarantool-patches] [PATCH luajit 14/15] test: fix E741 " Igor Munkin via Tarantool-patches
@ 2023-08-03 7:30 ` Igor Munkin via Tarantool-patches
2023-08-03 14:23 ` Sergey Bronnikov via Tarantool-patches
2023-08-03 21:02 ` Maxim Kokryashkin via Tarantool-patches
2023-08-21 11:05 ` [Tarantool-patches] [PATCH luajit 00/15] Add flake8 linter Igor Munkin via Tarantool-patches
15 siblings, 2 replies; 68+ messages in thread
From: Igor Munkin via Tarantool-patches @ 2023-08-03 7:30 UTC (permalink / raw)
To: Maxim Kokryashkin, Sergey Bronnikov; +Cc: tarantool-patches
This patch introduces a separate target to run flake8 against all Python
scripts within LuaJIT repository (i.e. debugger extensions). There are
some tweaks in .flake8rc regarding our style: one can find more info in
the config file.
The new target is a dependency for the new <LuaJIT-lint> target, that
joins both luacheck and flake8 linter runs. CI job with linters is
adjusted respectively.
Signed-off-by: Igor Munkin <imun@tarantool.org>
---
.flake8rc | 12 ++++++++++++
.github/workflows/lint.yml | 4 ++--
test/CMakeLists.txt | 28 ++++++++++++++++++++++++++++
3 files changed, 42 insertions(+), 2 deletions(-)
create mode 100644 .flake8rc
diff --git a/.flake8rc b/.flake8rc
new file mode 100644
index 00000000..b6f7ad48
--- /dev/null
+++ b/.flake8rc
@@ -0,0 +1,12 @@
+[flake8]
+extend-ignore =
+ # TODO: I have no idea, how to fix this. flake8 suggests nothing
+ # (like clang-format or checkpatch.pl do). Help needed.
+ E131,
+ # TODO: I have no idea, how to fix this. flake8 suggests nothing
+ # (like clang-format or checkpatch.pl do). Help needed.
+ E501,
+ # XXX: Suppress F821, since we have autogenerated names for
+ # 'ptr' type complements in luajit_lldb.py.
+ F821
+max-line-length = 80
diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml
index 70c98104..6b420f68 100644
--- a/.github/workflows/lint.yml
+++ b/.github/workflows/lint.yml
@@ -41,7 +41,7 @@ jobs:
run: |
# TODO: Move this step to a separate action.
sudo apt -y update
- sudo apt -y install cmake ninja-build lua5.1 luarocks
+ sudo apt -y install cmake ninja-build lua5.1 luarocks flake8
sudo luarocks install luacheck
# Set CMAKE_BUILD_PARALLEL_LEVEL environment variable to
# limit the number of parallel jobs for build/test step.
@@ -49,5 +49,5 @@ jobs:
- name: configure
run: cmake -S . -B ${{ env.BUILDDIR }} -G Ninja
- name: test
- run: cmake --build . --target LuaJIT-luacheck
+ run: cmake --build . --target LuaJIT-lint
working-directory: ${{ env.BUILDDIR }}
diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt
index 47296a22..17ac5cac 100644
--- a/test/CMakeLists.txt
+++ b/test/CMakeLists.txt
@@ -42,6 +42,34 @@ else()
)
endif()
+find_program(FLAKE8 flake8)
+if(FLAKE8)
+ get_filename_component(FLAKE8_SOURCE_DIR "${PROJECT_SOURCE_DIR}" REALPATH)
+ set(FLAKE8_RC ${FLAKE8_SOURCE_DIR}/.flake8rc)
+ file(GLOB_RECURSE FLAKE8_DEPS ${FLAKE8_SOURCE_DIR}/*.py)
+ add_custom_target(${PROJECT_NAME}-flake8
+ DEPENDS ${FLAKE8_DEPS}
+ )
+ add_custom_command(TARGET ${PROJECT_NAME}-flake8
+ COMMENT "Running flake8 static analysis"
+ COMMAND
+ ${FLAKE8} ${FLAKE8_DEPS}
+ --config ${FLAKE8_RC}
+ --jobs ${CMAKE_BUILD_PARALLEL_LEVEL}
+ WORKING_DIRECTORY ${FLAKE8_SOURCE_DIR}
+ )
+else()
+ add_custom_target(${PROJECT_NAME}-flake8)
+ add_custom_command(TARGET ${PROJECT_NAME}-flake8
+ COMMENT "`flake8' is not found, so ${PROJECT_NAME}-flake8 target is dummy"
+ )
+endif()
+
+add_custom_target(${PROJECT_NAME}-lint DEPENDS
+ ${PROJECT_NAME}-luacheck
+ ${PROJECT_NAME}-flake8
+)
+
set(LUAJIT_TEST_COMMAND "${LUAJIT_TEST_BINARY} -e dofile[[${LUAJIT_TEST_INIT}]]")
separate_arguments(LUAJIT_TEST_COMMAND)
--
2.30.2
^ permalink raw reply [flat|nested] 68+ messages in thread
* Re: [Tarantool-patches] [PATCH luajit 15/15] test: run flake8 static analysis via CMake
2023-08-03 7:30 ` [Tarantool-patches] [PATCH luajit 15/15] test: run flake8 static analysis via CMake Igor Munkin via Tarantool-patches
@ 2023-08-03 14:23 ` Sergey Bronnikov via Tarantool-patches
2023-08-03 14:25 ` Sergey Bronnikov via Tarantool-patches
2023-08-07 12:17 ` Igor Munkin via Tarantool-patches
2023-08-03 21:02 ` Maxim Kokryashkin via Tarantool-patches
1 sibling, 2 replies; 68+ messages in thread
From: Sergey Bronnikov via Tarantool-patches @ 2023-08-03 14:23 UTC (permalink / raw)
To: Igor Munkin, Maxim Kokryashkin; +Cc: tarantool-patches
[-- Attachment #1: Type: text/plain, Size: 4135 bytes --]
Hi, Igor
thanks for the patch! see my comments
Sergey
On 8/3/23 10:30, Igor Munkin wrote:
> This patch introduces a separate target to run flake8 against all Python
> scripts within LuaJIT repository (i.e. debugger extensions). There are
> some tweaks in .flake8rc regarding our style: one can find more info in
> the config file.
>
> The new target is a dependency for the new <LuaJIT-lint> target, that
> joins both luacheck and flake8 linter runs. CI job with linters is
> adjusted respectively.
>
> Signed-off-by: Igor Munkin<imun@tarantool.org>
> ---
> .flake8rc | 12 ++++++++++++
> .github/workflows/lint.yml | 4 ++--
> test/CMakeLists.txt | 28 ++++++++++++++++++++++++++++
> 3 files changed, 42 insertions(+), 2 deletions(-)
> create mode 100644 .flake8rc
>
> diff --git a/.flake8rc b/.flake8rc
> new file mode 100644
> index 00000000..b6f7ad48
> --- /dev/null
> +++ b/.flake8rc
> @@ -0,0 +1,12 @@
> +[flake8]
> +extend-ignore =
> + # TODO: I have no idea, how to fix this. flake8 suggests nothing
> + # (like clang-format or checkpatch.pl do). Help needed.
> + E131,
> + # TODO: I have no idea, how to fix this. flake8 suggests nothing
> + # (like clang-format or checkpatch.pl do). Help needed.
> + E501,
> + # XXX: Suppress F821, since we have autogenerated names for
> + # 'ptr' type complements in luajit_lldb.py.
> + F821
> +max-line-length = 80
> diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml
> index 70c98104..6b420f68 100644
> --- a/.github/workflows/lint.yml
> +++ b/.github/workflows/lint.yml
> @@ -41,7 +41,7 @@ jobs:
> run: |
> # TODO: Move this step to a separate action.
> sudo apt -y update
> - sudo apt -y install cmake ninja-build lua5.1 luarocks
> + sudo apt -y install cmake ninja-build lua5.1 luarocks flake8
> sudo luarocks install luacheck
> # Set CMAKE_BUILD_PARALLEL_LEVEL environment variable to
> # limit the number of parallel jobs for build/test step.
> @@ -49,5 +49,5 @@ jobs:
> - name: configure
> run: cmake -S . -B ${{ env.BUILDDIR }} -G Ninja
> - name: test
> - run: cmake --build . --target LuaJIT-luacheck
> + run: cmake --build . --target LuaJIT-lint
> working-directory: ${{ env.BUILDDIR }}
> diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt
> index 47296a22..17ac5cac 100644
> --- a/test/CMakeLists.txt
> +++ b/test/CMakeLists.txt
> @@ -42,6 +42,34 @@ else()
> )
> endif()
>
> +find_program(FLAKE8 flake8)
> +if(FLAKE8)
> + get_filename_component(FLAKE8_SOURCE_DIR "${PROJECT_SOURCE_DIR}" REALPATH)
Nit: name FLAKE8_SOURCE_DIR is confused, because dir has nothing common
with flake8. May be "REAL_SOURCE_DIR"?
> + set(FLAKE8_RC ${FLAKE8_SOURCE_DIR}/.flake8rc)
> + file(GLOB_RECURSE FLAKE8_DEPS ${FLAKE8_SOURCE_DIR}/*.py)
> + add_custom_target(${PROJECT_NAME}-flake8
> + DEPENDS ${FLAKE8_DEPS}
> + )
> + add_custom_command(TARGET ${PROJECT_NAME}-flake8
> + COMMENT "Running flake8 static analysis"
> + COMMAND
> + ${FLAKE8} ${FLAKE8_DEPS}
> + --config ${FLAKE8_RC}
> + --jobs ${CMAKE_BUILD_PARALLEL_LEVEL}
> + WORKING_DIRECTORY ${FLAKE8_SOURCE_DIR}
> + )
> +else()
> + add_custom_target(${PROJECT_NAME}-flake8)
> + add_custom_command(TARGET ${PROJECT_NAME}-flake8
> + COMMENT "`flake8' is not found, so ${PROJECT_NAME}-flake8 target is dummy"
Please add a command to a dummy target:
|COMMAND ${CMAKE_COMMAND} -E cmake_echo_color --red "||`flake8' is not found, so ${PROJECT_NAME}-flake8 target is dummy" with
added COMMAND target will print a message |
> + )
> +endif()
> +
> +add_custom_target(${PROJECT_NAME}-lint DEPENDS
> + ${PROJECT_NAME}-luacheck
> + ${PROJECT_NAME}-flake8
> +)
> +
> set(LUAJIT_TEST_COMMAND "${LUAJIT_TEST_BINARY} -e dofile[[${LUAJIT_TEST_INIT}]]")
> separate_arguments(LUAJIT_TEST_COMMAND)
>
You've introduced a new target LuaJIT-lint, that includes
LuaJIT-luacheck and LuaJIT-flake8.
I suppose we need replace dependence "LuaJIT-luacheck" to "LuaJIT-lint"
for a target "test".
[-- Attachment #2: Type: text/html, Size: 7168 bytes --]
^ permalink raw reply [flat|nested] 68+ messages in thread
* Re: [Tarantool-patches] [PATCH luajit 15/15] test: run flake8 static analysis via CMake
2023-08-03 14:23 ` Sergey Bronnikov via Tarantool-patches
@ 2023-08-03 14:25 ` Sergey Bronnikov via Tarantool-patches
2023-08-07 13:35 ` Igor Munkin via Tarantool-patches
2023-08-07 12:17 ` Igor Munkin via Tarantool-patches
1 sibling, 1 reply; 68+ messages in thread
From: Sergey Bronnikov via Tarantool-patches @ 2023-08-03 14:25 UTC (permalink / raw)
To: Igor Munkin, Maxim Kokryashkin; +Cc: tarantool-patches
LuaJIT-lint reports 4 warnings:
Total: 0 warnings / 0 errors in 108 files
Built target LuaJIT-luacheck
/home/sergeyb/sources/MRG/tarantool/third_party/luajit/src/luajit-gdb.py:330:11:
E275 missing whitespace after keyword
/home/sergeyb/sources/MRG/tarantool/third_party/luajit/src/luajit-gdb.py:338:10:
E275 missing whitespace after keyword
/home/sergeyb/sources/MRG/tarantool/third_party/luajit/src/luajit_lldb.py:391:10:
E275 missing whitespace after keyword
/home/sergeyb/sources/MRG/tarantool/third_party/luajit/src/luajit_lldb.py:519:11:
E275 missing whitespace after keyword
On 8/3/23 17:23, Sergey Bronnikov via Tarantool-patches wrote:
>
> Hi, Igor
>
>
> thanks for the patch! see my comments
>
<snipped>
^ permalink raw reply [flat|nested] 68+ messages in thread
* Re: [Tarantool-patches] [PATCH luajit 15/15] test: run flake8 static analysis via CMake
2023-08-03 14:25 ` Sergey Bronnikov via Tarantool-patches
@ 2023-08-07 13:35 ` Igor Munkin via Tarantool-patches
2023-08-07 13:41 ` [Tarantool-patches] [PATCH luajit 16/15] gdb: fix Python <assert> statement usage Igor Munkin via Tarantool-patches
` (2 more replies)
0 siblings, 3 replies; 68+ messages in thread
From: Igor Munkin via Tarantool-patches @ 2023-08-07 13:35 UTC (permalink / raw)
To: Sergey Bronnikov; +Cc: tarantool-patches
OK, this is sad. Again, something is not covered "by default" in CI.
All problems are described below.
The most important, flake8 is too old in our Linux repos (see below): |
flake8 is already the newest version (3.7.9-2). Hence, I decided to fix
the version to 6.1.0 as the newest one for the following reasons:
* New heuristics are added (AFAIR, you used 6.0.0 below), so more
errors are found.
* Unexpected upgrade to the new version of flake8 can lead to new error
errors, so CI can fail for no reason. Hence pinning the version
provides more control for CI (and this is horosho).
Here is the diff:
================================================================================
diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml
index 2d227118..b4e66f53 100644
--- a/.github/workflows/lint.yml
+++ b/.github/workflows/lint.yml
@@ -41,8 +41,9 @@ jobs:
run: |
# TODO: Move this step to a separate action.
sudo apt -y update
- sudo apt -y install cmake ninja-build lua5.1 luarocks flake8
+ sudo apt -y install cmake ninja-build lua5.1 luarocks
sudo luarocks install luacheck
+ sudo pip3 install flake8==6.1.0
# Set CMAKE_BUILD_PARALLEL_LEVEL environment variable to
# limit the number of parallel jobs for build/test step.
echo CMAKE_BUILD_PARALLEL_LEVEL=$(($(nproc) + 1)) | tee -a $GITHUB_ENV
================================================================================
As a result of this change, all the errors mentioned below are reported
by our CI[1]. OK, what about the errors per se (see below).
On 03.08.23, Sergey Bronnikov wrote:
> LuaJIT-lint reports 4 warnings:
>
>
> Total: 0 warnings / 0 errors in 108 files
> Built target LuaJIT-luacheck
> /home/sergeyb/sources/MRG/tarantool/third_party/luajit/src/luajit-gdb.py:330:11:
> E275 missing whitespace after keyword
> /home/sergeyb/sources/MRG/tarantool/third_party/luajit/src/luajit-gdb.py:338:10:
> E275 missing whitespace after keyword
> /home/sergeyb/sources/MRG/tarantool/third_party/luajit/src/luajit_lldb.py:391:10:
> E275 missing whitespace after keyword
> /home/sergeyb/sources/MRG/tarantool/third_party/luajit/src/luajit_lldb.py:519:11:
> E275 missing whitespace after keyword
The 1st and the 3rd errors are not just style issues, but the actual
errors. <assert> is a statement in Python, so the parenthesis are
considered as a tuple constructor. Fixed it in scope of the separate
commit (will send in reply to this message).
The remaining issues relates to missing whitespace, so I fixed it the
same way all other style violations were fixed (will also send the patch
in reply to this message).
>
> On 8/3/23 17:23, Sergey Bronnikov via Tarantool-patches wrote:
> >
> > Hi, Igor
> >
> >
> > thanks for the patch! see my comments
> >
>
> <snipped>
>
[1]: https://github.com/tarantool/luajit/actions/runs/5785548226/job/15678397206
--
Best regards,
IM
^ permalink raw reply [flat|nested] 68+ messages in thread
* [Tarantool-patches] [PATCH luajit 16/15] gdb: fix Python <assert> statement usage
2023-08-07 13:35 ` Igor Munkin via Tarantool-patches
@ 2023-08-07 13:41 ` Igor Munkin via Tarantool-patches
2023-08-08 8:26 ` Sergey Bronnikov via Tarantool-patches
2023-08-13 20:24 ` Maxim Kokryashkin via Tarantool-patches
2023-08-07 13:41 ` [Tarantool-patches] [PATCH luajit 17/15] test: fix E275 errors by pycodestyle Igor Munkin via Tarantool-patches
2023-08-08 8:18 ` [Tarantool-patches] [PATCH luajit 15/15] test: run flake8 static analysis via CMake Sergey Bronnikov via Tarantool-patches
2 siblings, 2 replies; 68+ messages in thread
From: Igor Munkin via Tarantool-patches @ 2023-08-07 13:41 UTC (permalink / raw)
To: Maxim Kokryashkin, Sergey Bronnikov; +Cc: tarantool-patches
This <assert> misuse was introduced in the initial implementation of GDB
extension within the commit 58790750b9c4bd4c21d883f109ab552a2e202a15
("gdb: introduce luajit-gdb extension") and also propagated to the
initial implementation of LLDB extension by copy-pasting in scope of the
commit 62fc84a8f89b8e5650162ba1c7696b0f84cf5c25 ("lldb: introduce
luajit-lldb"). However, <assert> is not a function, but statement, so
parenthesis around the condition are considered as a tuple constructor.
This patch simply removes the excess parenthesis to finally follow
Python semantics of the <assert> statement.
Signed-off-by: Igor Munkin <imun@tarantool.org>
---
**NB**: This patch will be placed before "[PATCH luajit 01/15] test: fix
E122 errors by pycodestyle" on the branch.
CI: https://github.com/tarantool/luajit/actions/runs/5785962723/job/15679677849
src/luajit-gdb.py | 2 +-
src/luajit_lldb.py | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/luajit-gdb.py b/src/luajit-gdb.py
index 9075e99f..b7902d53 100644
--- a/src/luajit-gdb.py
+++ b/src/luajit-gdb.py
@@ -327,7 +327,7 @@ def itypemap(o):
def funcproto(func):
- assert(func['ffid'] == 0)
+ assert func['ffid'] == 0
return cast('GCproto *',
mref('char *', func['pc']) - gdb.lookup_type('GCproto').sizeof)
diff --git a/src/luajit_lldb.py b/src/luajit_lldb.py
index 85c0dcb9..94f54a59 100644
--- a/src/luajit_lldb.py
+++ b/src/luajit_lldb.py
@@ -516,7 +516,7 @@ def strx64(val):
def funcproto(func):
- assert(func.ffid == 0)
+ assert func.ffid == 0
proto_size = sizeof('GCproto')
value = cast('uintptr_t', vtou64(mref('char *', func.pc)) - proto_size)
return cast(GCprotoPtr, value)
--
2.30.2
^ permalink raw reply [flat|nested] 68+ messages in thread
* Re: [Tarantool-patches] [PATCH luajit 16/15] gdb: fix Python <assert> statement usage
2023-08-07 13:41 ` [Tarantool-patches] [PATCH luajit 16/15] gdb: fix Python <assert> statement usage Igor Munkin via Tarantool-patches
@ 2023-08-08 8:26 ` Sergey Bronnikov via Tarantool-patches
2023-08-13 20:24 ` Maxim Kokryashkin via Tarantool-patches
1 sibling, 0 replies; 68+ messages in thread
From: Sergey Bronnikov via Tarantool-patches @ 2023-08-08 8:26 UTC (permalink / raw)
To: Igor Munkin, Maxim Kokryashkin; +Cc: tarantool-patches
LGTM, thanks!
On 8/7/23 16:41, Igor Munkin wrote:
> This <assert> misuse was introduced in the initial implementation of GDB
> extension within the commit 58790750b9c4bd4c21d883f109ab552a2e202a15
> ("gdb: introduce luajit-gdb extension") and also propagated to the
> initial implementation of LLDB extension by copy-pasting in scope of the
> commit 62fc84a8f89b8e5650162ba1c7696b0f84cf5c25 ("lldb: introduce
> luajit-lldb"). However, <assert> is not a function, but statement, so
> parenthesis around the condition are considered as a tuple constructor.
> This patch simply removes the excess parenthesis to finally follow
> Python semantics of the <assert> statement.
>
> Signed-off-by: Igor Munkin <imun@tarantool.org>
> ---
>
> **NB**: This patch will be placed before "[PATCH luajit 01/15] test: fix
> E122 errors by pycodestyle" on the branch.
>
> CI: https://github.com/tarantool/luajit/actions/runs/5785962723/job/15679677849
>
> src/luajit-gdb.py | 2 +-
> src/luajit_lldb.py | 2 +-
> 2 files changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/src/luajit-gdb.py b/src/luajit-gdb.py
> index 9075e99f..b7902d53 100644
> --- a/src/luajit-gdb.py
> +++ b/src/luajit-gdb.py
> @@ -327,7 +327,7 @@ def itypemap(o):
>
>
> def funcproto(func):
> - assert(func['ffid'] == 0)
> + assert func['ffid'] == 0
>
> return cast('GCproto *',
> mref('char *', func['pc']) - gdb.lookup_type('GCproto').sizeof)
> diff --git a/src/luajit_lldb.py b/src/luajit_lldb.py
> index 85c0dcb9..94f54a59 100644
> --- a/src/luajit_lldb.py
> +++ b/src/luajit_lldb.py
> @@ -516,7 +516,7 @@ def strx64(val):
>
>
> def funcproto(func):
> - assert(func.ffid == 0)
> + assert func.ffid == 0
> proto_size = sizeof('GCproto')
> value = cast('uintptr_t', vtou64(mref('char *', func.pc)) - proto_size)
> return cast(GCprotoPtr, value)
^ permalink raw reply [flat|nested] 68+ messages in thread
* Re: [Tarantool-patches] [PATCH luajit 16/15] gdb: fix Python <assert> statement usage
2023-08-07 13:41 ` [Tarantool-patches] [PATCH luajit 16/15] gdb: fix Python <assert> statement usage Igor Munkin via Tarantool-patches
2023-08-08 8:26 ` Sergey Bronnikov via Tarantool-patches
@ 2023-08-13 20:24 ` Maxim Kokryashkin via Tarantool-patches
1 sibling, 0 replies; 68+ messages in thread
From: Maxim Kokryashkin via Tarantool-patches @ 2023-08-13 20:24 UTC (permalink / raw)
To: Igor Munkin; +Cc: tarantool-patches
[-- Attachment #1: Type: text/plain, Size: 1955 bytes --]
Hi!
Thanks for the patch!
LGTM
--
Best regards,
Maxim Kokryashkin
>
>>This <assert> misuse was introduced in the initial implementation of GDB
>>extension within the commit 58790750b9c4bd4c21d883f109ab552a2e202a15
>>("gdb: introduce luajit-gdb extension") and also propagated to the
>>initial implementation of LLDB extension by copy-pasting in scope of the
>>commit 62fc84a8f89b8e5650162ba1c7696b0f84cf5c25 ("lldb: introduce
>>luajit-lldb"). However, <assert> is not a function, but statement, so
>>parenthesis around the condition are considered as a tuple constructor.
>>This patch simply removes the excess parenthesis to finally follow
>>Python semantics of the <assert> statement.
>>
>>Signed-off-by: Igor Munkin < imun@tarantool.org >
>>---
>>
>>**NB**: This patch will be placed before "[PATCH luajit 01/15] test: fix
>>E122 errors by pycodestyle" on the branch.
>>
>>CI: https://github.com/tarantool/luajit/actions/runs/5785962723/job/15679677849
>>
>> src/luajit-gdb.py | 2 +-
>> src/luajit_lldb.py | 2 +-
>> 2 files changed, 2 insertions(+), 2 deletions(-)
>>
>>diff --git a/src/luajit-gdb.py b/src/luajit-gdb.py
>>index 9075e99f..b7902d53 100644
>>--- a/src/luajit-gdb.py
>>+++ b/src/luajit-gdb.py
>>@@ -327,7 +327,7 @@ def itypemap(o):
>>
>>
>> def funcproto(func):
>>- assert(func['ffid'] == 0)
>>+ assert func['ffid'] == 0
>>
>> return cast('GCproto *',
>> mref('char *', func['pc']) - gdb.lookup_type('GCproto').sizeof)
>>diff --git a/src/luajit_lldb.py b/src/luajit_lldb.py
>>index 85c0dcb9..94f54a59 100644
>>--- a/src/luajit_lldb.py
>>+++ b/src/luajit_lldb.py
>>@@ -516,7 +516,7 @@ def strx64(val):
>>
>>
>> def funcproto(func):
>>- assert(func.ffid == 0)
>>+ assert func.ffid == 0
>> proto_size = sizeof('GCproto')
>> value = cast('uintptr_t', vtou64(mref('char *', func.pc)) - proto_size)
>> return cast(GCprotoPtr, value)
>>--
>>2.30.2
>
[-- Attachment #2: Type: text/html, Size: 2898 bytes --]
^ permalink raw reply [flat|nested] 68+ messages in thread
* [Tarantool-patches] [PATCH luajit 17/15] test: fix E275 errors by pycodestyle
2023-08-07 13:35 ` Igor Munkin via Tarantool-patches
2023-08-07 13:41 ` [Tarantool-patches] [PATCH luajit 16/15] gdb: fix Python <assert> statement usage Igor Munkin via Tarantool-patches
@ 2023-08-07 13:41 ` Igor Munkin via Tarantool-patches
2023-08-08 8:26 ` Sergey Bronnikov via Tarantool-patches
2023-08-13 19:25 ` Maxim Kokryashkin via Tarantool-patches
2023-08-08 8:18 ` [Tarantool-patches] [PATCH luajit 15/15] test: run flake8 static analysis via CMake Sergey Bronnikov via Tarantool-patches
2 siblings, 2 replies; 68+ messages in thread
From: Igor Munkin via Tarantool-patches @ 2023-08-07 13:41 UTC (permalink / raw)
To: Maxim Kokryashkin, Sergey Bronnikov; +Cc: tarantool-patches
Fixed 2 occurrences of E275 ("missing whitespace after keyword") error
reported by pycodestyle[1].
[1]: https://www.flake8rules.com/rules/E275.html
Signed-off-by: Igor Munkin <imun@tarantool.org>
---
**NB**: This patch will be placed between "[PATCH luajit 06/15] test:
fix E251 errors by pycodestyle" and "[PATCH luajit 08/15] test: fix E302
errors by pycodestyle" on the branch.
CI: https://github.com/tarantool/luajit/actions/runs/5785962723/job/15679677849
src/luajit-gdb.py | 2 +-
src/luajit_lldb.py | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/luajit-gdb.py b/src/luajit-gdb.py
index b7902d53..f9623e53 100644
--- a/src/luajit-gdb.py
+++ b/src/luajit-gdb.py
@@ -335,7 +335,7 @@ def funcproto(func):
def gclistlen(root, end=0x0):
count = 0
- while(gcref(root) != end):
+ while (gcref(root) != end):
count += 1
root = gcnext(root)
return count
diff --git a/src/luajit_lldb.py b/src/luajit_lldb.py
index 94f54a59..53f3abca 100644
--- a/src/luajit_lldb.py
+++ b/src/luajit_lldb.py
@@ -388,7 +388,7 @@ def gcnext(obj):
def gclistlen(root, end=0x0):
count = 0
- while(gcref(root) != end):
+ while (gcref(root) != end):
count += 1
root = gcnext(root)
return count
--
2.30.2
^ permalink raw reply [flat|nested] 68+ messages in thread
* Re: [Tarantool-patches] [PATCH luajit 17/15] test: fix E275 errors by pycodestyle
2023-08-07 13:41 ` [Tarantool-patches] [PATCH luajit 17/15] test: fix E275 errors by pycodestyle Igor Munkin via Tarantool-patches
@ 2023-08-08 8:26 ` Sergey Bronnikov via Tarantool-patches
2023-08-13 19:25 ` Maxim Kokryashkin via Tarantool-patches
1 sibling, 0 replies; 68+ messages in thread
From: Sergey Bronnikov via Tarantool-patches @ 2023-08-08 8:26 UTC (permalink / raw)
To: Igor Munkin, Maxim Kokryashkin; +Cc: tarantool-patches
LGTM
On 8/7/23 16:41, Igor Munkin wrote:
> Fixed 2 occurrences of E275 ("missing whitespace after keyword") error
> reported by pycodestyle[1].
>
> [1]: https://www.flake8rules.com/rules/E275.html
>
> Signed-off-by: Igor Munkin <imun@tarantool.org>
> ---
>
> **NB**: This patch will be placed between "[PATCH luajit 06/15] test:
> fix E251 errors by pycodestyle" and "[PATCH luajit 08/15] test: fix E302
> errors by pycodestyle" on the branch.
>
> CI: https://github.com/tarantool/luajit/actions/runs/5785962723/job/15679677849
>
> src/luajit-gdb.py | 2 +-
> src/luajit_lldb.py | 2 +-
> 2 files changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/src/luajit-gdb.py b/src/luajit-gdb.py
> index b7902d53..f9623e53 100644
> --- a/src/luajit-gdb.py
> +++ b/src/luajit-gdb.py
> @@ -335,7 +335,7 @@ def funcproto(func):
>
> def gclistlen(root, end=0x0):
> count = 0
> - while(gcref(root) != end):
> + while (gcref(root) != end):
> count += 1
> root = gcnext(root)
> return count
> diff --git a/src/luajit_lldb.py b/src/luajit_lldb.py
> index 94f54a59..53f3abca 100644
> --- a/src/luajit_lldb.py
> +++ b/src/luajit_lldb.py
> @@ -388,7 +388,7 @@ def gcnext(obj):
>
> def gclistlen(root, end=0x0):
> count = 0
> - while(gcref(root) != end):
> + while (gcref(root) != end):
> count += 1
> root = gcnext(root)
> return count
^ permalink raw reply [flat|nested] 68+ messages in thread
* Re: [Tarantool-patches] [PATCH luajit 17/15] test: fix E275 errors by pycodestyle
2023-08-07 13:41 ` [Tarantool-patches] [PATCH luajit 17/15] test: fix E275 errors by pycodestyle Igor Munkin via Tarantool-patches
2023-08-08 8:26 ` Sergey Bronnikov via Tarantool-patches
@ 2023-08-13 19:25 ` Maxim Kokryashkin via Tarantool-patches
1 sibling, 0 replies; 68+ messages in thread
From: Maxim Kokryashkin via Tarantool-patches @ 2023-08-13 19:25 UTC (permalink / raw)
To: Igor Munkin; +Cc: tarantool-patches
[-- Attachment #1: Type: text/plain, Size: 1517 bytes --]
Hi, Igor!
Thanks for the patch!
LGTM
--
Best regards,
Maxim Kokryashkin
>
>>Fixed 2 occurrences of E275 ("missing whitespace after keyword") error
>>reported by pycodestyle[1].
>>
>>[1]: https://www.flake8rules.com/rules/E275.html
>>
>>Signed-off-by: Igor Munkin < imun@tarantool.org >
>>---
>>
>>**NB**: This patch will be placed between "[PATCH luajit 06/15] test:
>>fix E251 errors by pycodestyle" and "[PATCH luajit 08/15] test: fix E302
>>errors by pycodestyle" on the branch.
>>
>>CI: https://github.com/tarantool/luajit/actions/runs/5785962723/job/15679677849
>>
>> src/luajit-gdb.py | 2 +-
>> src/luajit_lldb.py | 2 +-
>> 2 files changed, 2 insertions(+), 2 deletions(-)
>>
>>diff --git a/src/luajit-gdb.py b/src/luajit-gdb.py
>>index b7902d53..f9623e53 100644
>>--- a/src/luajit-gdb.py
>>+++ b/src/luajit-gdb.py
>>@@ -335,7 +335,7 @@ def funcproto(func):
>>
>> def gclistlen(root, end=0x0):
>> count = 0
>>- while(gcref(root) != end):
>>+ while (gcref(root) != end):
>> count += 1
>> root = gcnext(root)
>> return count
>>diff --git a/src/luajit_lldb.py b/src/luajit_lldb.py
>>index 94f54a59..53f3abca 100644
>>--- a/src/luajit_lldb.py
>>+++ b/src/luajit_lldb.py
>>@@ -388,7 +388,7 @@ def gcnext(obj):
>>
>> def gclistlen(root, end=0x0):
>> count = 0
>>- while(gcref(root) != end):
>>+ while (gcref(root) != end):
>> count += 1
>> root = gcnext(root)
>> return count
>>--
>>2.30.2
>
[-- Attachment #2: Type: text/html, Size: 2575 bytes --]
^ permalink raw reply [flat|nested] 68+ messages in thread
* Re: [Tarantool-patches] [PATCH luajit 15/15] test: run flake8 static analysis via CMake
2023-08-07 13:35 ` Igor Munkin via Tarantool-patches
2023-08-07 13:41 ` [Tarantool-patches] [PATCH luajit 16/15] gdb: fix Python <assert> statement usage Igor Munkin via Tarantool-patches
2023-08-07 13:41 ` [Tarantool-patches] [PATCH luajit 17/15] test: fix E275 errors by pycodestyle Igor Munkin via Tarantool-patches
@ 2023-08-08 8:18 ` Sergey Bronnikov via Tarantool-patches
2 siblings, 0 replies; 68+ messages in thread
From: Sergey Bronnikov via Tarantool-patches @ 2023-08-08 8:18 UTC (permalink / raw)
To: Igor Munkin; +Cc: tarantool-patches
Thanks, Igor!
LGTM
On 8/7/23 16:35, Igor Munkin wrote:
> OK, this is sad. Again, something is not covered "by default" in CI.
> All problems are described below.
>
> The most important, flake8 is too old in our Linux repos (see below): |
> flake8 is already the newest version (3.7.9-2). Hence, I decided to fix
> the version to 6.1.0 as the newest one for the following reasons:
> * New heuristics are added (AFAIR, you used 6.0.0 below), so more
> errors are found.
> * Unexpected upgrade to the new version of flake8 can lead to new error
> errors, so CI can fail for no reason. Hence pinning the version
> provides more control for CI (and this is horosho).
>
> Here is the diff:
>
> ================================================================================
>
> diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml
> index 2d227118..b4e66f53 100644
> --- a/.github/workflows/lint.yml
> +++ b/.github/workflows/lint.yml
> @@ -41,8 +41,9 @@ jobs:
> run: |
> # TODO: Move this step to a separate action.
> sudo apt -y update
> - sudo apt -y install cmake ninja-build lua5.1 luarocks flake8
> + sudo apt -y install cmake ninja-build lua5.1 luarocks
> sudo luarocks install luacheck
> + sudo pip3 install flake8==6.1.0
> # Set CMAKE_BUILD_PARALLEL_LEVEL environment variable to
> # limit the number of parallel jobs for build/test step.
> echo CMAKE_BUILD_PARALLEL_LEVEL=$(($(nproc) + 1)) | tee -a $GITHUB_ENV
>
> ================================================================================
>
> As a result of this change, all the errors mentioned below are reported
> by our CI[1]. OK, what about the errors per se (see below).
>
> On 03.08.23, Sergey Bronnikov wrote:
>> LuaJIT-lint reports 4 warnings:
>>
>>
>> Total: 0 warnings / 0 errors in 108 files
>> Built target LuaJIT-luacheck
>> /home/sergeyb/sources/MRG/tarantool/third_party/luajit/src/luajit-gdb.py:330:11:
>> E275 missing whitespace after keyword
>> /home/sergeyb/sources/MRG/tarantool/third_party/luajit/src/luajit-gdb.py:338:10:
>> E275 missing whitespace after keyword
>> /home/sergeyb/sources/MRG/tarantool/third_party/luajit/src/luajit_lldb.py:391:10:
>> E275 missing whitespace after keyword
>> /home/sergeyb/sources/MRG/tarantool/third_party/luajit/src/luajit_lldb.py:519:11:
>> E275 missing whitespace after keyword
> The 1st and the 3rd errors are not just style issues, but the actual
> errors. <assert> is a statement in Python, so the parenthesis are
> considered as a tuple constructor. Fixed it in scope of the separate
> commit (will send in reply to this message).
>
> The remaining issues relates to missing whitespace, so I fixed it the
> same way all other style violations were fixed (will also send the patch
> in reply to this message).
>
>> On 8/3/23 17:23, Sergey Bronnikov via Tarantool-patches wrote:
>>> Hi, Igor
>>>
>>>
>>> thanks for the patch! see my comments
>>>
>> <snipped>
>>
> [1]: https://github.com/tarantool/luajit/actions/runs/5785548226/job/15678397206
>
^ permalink raw reply [flat|nested] 68+ messages in thread
* Re: [Tarantool-patches] [PATCH luajit 15/15] test: run flake8 static analysis via CMake
2023-08-03 14:23 ` Sergey Bronnikov via Tarantool-patches
2023-08-03 14:25 ` Sergey Bronnikov via Tarantool-patches
@ 2023-08-07 12:17 ` Igor Munkin via Tarantool-patches
2023-08-07 13:48 ` Sergey Bronnikov via Tarantool-patches
1 sibling, 1 reply; 68+ messages in thread
From: Igor Munkin via Tarantool-patches @ 2023-08-07 12:17 UTC (permalink / raw)
To: Sergey Bronnikov; +Cc: tarantool-patches
Sergey,
Thanks for your review!
On 03.08.23, Sergey Bronnikov wrote:
> Hi, Igor
>
>
> thanks for the patch! see my comments
>
>
> Sergey
>
> On 8/3/23 10:30, Igor Munkin wrote:
> > This patch introduces a separate target to run flake8 against all Python
> > scripts within LuaJIT repository (i.e. debugger extensions). There are
> > some tweaks in .flake8rc regarding our style: one can find more info in
> > the config file.
> >
> > The new target is a dependency for the new <LuaJIT-lint> target, that
> > joins both luacheck and flake8 linter runs. CI job with linters is
> > adjusted respectively.
> >
> > Signed-off-by: Igor Munkin<imun@tarantool.org>
> > ---
> > .flake8rc | 12 ++++++++++++
> > .github/workflows/lint.yml | 4 ++--
> > test/CMakeLists.txt | 28 ++++++++++++++++++++++++++++
> > 3 files changed, 42 insertions(+), 2 deletions(-)
> > create mode 100644 .flake8rc
> >
<snipped>
> > diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt
> > index 47296a22..17ac5cac 100644
> > --- a/test/CMakeLists.txt
> > +++ b/test/CMakeLists.txt
> > @@ -42,6 +42,34 @@ else()
> > )
> > endif()
> > +find_program(FLAKE8 flake8)
> > +if(FLAKE8)
> > + get_filename_component(FLAKE8_SOURCE_DIR "${PROJECT_SOURCE_DIR}" REALPATH)
> Nit: name FLAKE8_SOURCE_DIR is confused, because dir has nothing common with
> flake8. May be "REAL_SOURCE_DIR"?
The semantics are the same as for LUACHECK_SOURCE_DIR: it should be read
as "the directory with sources to be checked via flake8". Ignoring.
> > + set(FLAKE8_RC ${FLAKE8_SOURCE_DIR}/.flake8rc)
> > + file(GLOB_RECURSE FLAKE8_DEPS ${FLAKE8_SOURCE_DIR}/*.py)
> > + add_custom_target(${PROJECT_NAME}-flake8
> > + DEPENDS ${FLAKE8_DEPS}
> > + )
> > + add_custom_command(TARGET ${PROJECT_NAME}-flake8
> > + COMMENT "Running flake8 static analysis"
> > + COMMAND
> > + ${FLAKE8} ${FLAKE8_DEPS}
> > + --config ${FLAKE8_RC}
> > + --jobs ${CMAKE_BUILD_PARALLEL_LEVEL}
> > + WORKING_DIRECTORY ${FLAKE8_SOURCE_DIR}
> > + )
> > +else()
> > + add_custom_target(${PROJECT_NAME}-flake8)
> > + add_custom_command(TARGET ${PROJECT_NAME}-flake8
> > + COMMENT "`flake8' is not found, so ${PROJECT_NAME}-flake8 target is dummy"
>
> Please add a command to a dummy target:
>
> |COMMAND ${CMAKE_COMMAND} -E cmake_echo_color --red "||`flake8' is not
> found, so ${PROJECT_NAME}-flake8 target is dummy" with added COMMAND target
> will print a message |
Well, 0 days since "CMake is doing something unexpected". COMMENT is
totally fine, the problem is in Ninja generated artefacts: I'm not an
expert in Ninja but looks like CMake generates kinda nop if COMMAND is
omitted. Here is the dump:
| $ cmake --version
| cmake version 3.26.4
|
| CMake suite maintained and supported by Kitware (kitware.com/cmake).
| $ rm -f CMakeCache.txt
| $ cmake . -G Ninja
| -- The C compiler identification is GNU 13.2.0
| -- Detecting C compiler ABI info
| -- Detecting C compiler ABI info - done
| -- Check for working C compiler: /usr/bin/cc - skipped
| -- Detecting C compile features
| -- Detecting C compile features - done
| -- [SetVersion] Reading version from VCS: v2.1.0-beta3-355-g6dd0b0e2
| -- [SetBuildParallelLevel] CMAKE_BUILD_PARALLEL_LEVEL is 4
| -- The ASM compiler identification is GNU
| -- Found assembler: /usr/bin/cc
| -- Configuring done (0.3s)
| -- Generating done (0.0s)
| -- Build files have been written to: /home/imun/projects/tarantool-luajit
| $ cmake --build . --target LuaJIT-flake8
| ninja: no work to do.
| $ rm -f CMakeCache.txt
| $ cmake .
| -- The C compiler identification is GNU 13.2.0
| -- Detecting C compiler ABI info
| -- Detecting C compiler ABI info - done
| -- Check for working C compiler: /usr/bin/cc - skipped
| -- Detecting C compile features
| -- Detecting C compile features - done
| -- [SetVersion] Reading version from VCS: v2.1.0-beta3-355-g6dd0b0e2
| -- [SetBuildParallelLevel] CMAKE_BUILD_PARALLEL_LEVEL is 4
| -- The ASM compiler identification is GNU
| -- Found assembler: /usr/bin/cc
| -- Configuring done (0.3s)
| -- Generating done (0.1s)
| -- Build files have been written to: /home/imun/projects/tarantool-luajit
| $ cmake --build . --target LuaJIT-flake8
| `flake8' is not found, so LuaJIT-flake8 target is dummy
| Built target LuaJIT-flake8
Hence, I suggest to leave everything as is (see luacheck-related part),
but in scope of the CTest series implement another way of interaction
with user. Does it work for you?
>
> > + )
> > +endif()
> > +
> > +add_custom_target(${PROJECT_NAME}-lint DEPENDS
> > + ${PROJECT_NAME}-luacheck
> > + ${PROJECT_NAME}-flake8
> > +)
> > +
> > set(LUAJIT_TEST_COMMAND "${LUAJIT_TEST_BINARY} -e dofile[[${LUAJIT_TEST_INIT}]]")
> > separate_arguments(LUAJIT_TEST_COMMAND)
>
> You've introduced a new target LuaJIT-lint, that includes LuaJIT-luacheck
> and LuaJIT-flake8.
>
> I suppose we need replace dependence "LuaJIT-luacheck" to "LuaJIT-lint" for
> a target "test".
Oops, my bad, thanks! Fixed.
================================================================================
diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt
index 17ac5cac..58cba5ba 100644
--- a/test/CMakeLists.txt
+++ b/test/CMakeLists.txt
@@ -102,6 +102,6 @@ if(LUAJIT_USE_TEST)
add_custom_target(test DEPENDS
${PROJECT_NAME}-test
- ${PROJECT_NAME}-luacheck
+ ${PROJECT_NAME}-lint
)
endif()
================================================================================
--
Best regards,
IM
^ permalink raw reply [flat|nested] 68+ messages in thread
* Re: [Tarantool-patches] [PATCH luajit 15/15] test: run flake8 static analysis via CMake
2023-08-07 12:17 ` Igor Munkin via Tarantool-patches
@ 2023-08-07 13:48 ` Sergey Bronnikov via Tarantool-patches
0 siblings, 0 replies; 68+ messages in thread
From: Sergey Bronnikov via Tarantool-patches @ 2023-08-07 13:48 UTC (permalink / raw)
To: Igor Munkin; +Cc: tarantool-patches
Igor,
On 8/7/23 15:17, Igor Munkin wrote:
<snipped>
>>> + set(FLAKE8_RC ${FLAKE8_SOURCE_DIR}/.flake8rc)
>>> + file(GLOB_RECURSE FLAKE8_DEPS ${FLAKE8_SOURCE_DIR}/*.py)
>>> + add_custom_target(${PROJECT_NAME}-flake8
>>> + DEPENDS ${FLAKE8_DEPS}
>>> + )
>>> + add_custom_command(TARGET ${PROJECT_NAME}-flake8
>>> + COMMENT "Running flake8 static analysis"
>>> + COMMAND
>>> + ${FLAKE8} ${FLAKE8_DEPS}
>>> + --config ${FLAKE8_RC}
>>> + --jobs ${CMAKE_BUILD_PARALLEL_LEVEL}
>>> + WORKING_DIRECTORY ${FLAKE8_SOURCE_DIR}
>>> + )
>>> +else()
>>> + add_custom_target(${PROJECT_NAME}-flake8)
>>> + add_custom_command(TARGET ${PROJECT_NAME}-flake8
>>> + COMMENT "`flake8' is not found, so ${PROJECT_NAME}-flake8 target is dummy"
>> Please add a command to a dummy target:
>>
>> |COMMAND ${CMAKE_COMMAND} -E cmake_echo_color --red "||`flake8' is not
>> found, so ${PROJECT_NAME}-flake8 target is dummy" with added COMMAND target
>> will print a message |
> Well, 0 days since "CMake is doing something unexpected". COMMENT is
> totally fine, the problem is in Ninja generated artefacts: I'm not an
> expert in Ninja but looks like CMake generates kinda nop if COMMAND is
> omitted. Here is the dump:
>
> | $ cmake --version
> | cmake version 3.26.4
> |
> | CMake suite maintained and supported by Kitware (kitware.com/cmake).
> | $ rm -f CMakeCache.txt
> | $ cmake . -G Ninja
> | -- The C compiler identification is GNU 13.2.0
> | -- Detecting C compiler ABI info
> | -- Detecting C compiler ABI info - done
> | -- Check for working C compiler: /usr/bin/cc - skipped
> | -- Detecting C compile features
> | -- Detecting C compile features - done
> | -- [SetVersion] Reading version from VCS: v2.1.0-beta3-355-g6dd0b0e2
> | -- [SetBuildParallelLevel] CMAKE_BUILD_PARALLEL_LEVEL is 4
> | -- The ASM compiler identification is GNU
> | -- Found assembler: /usr/bin/cc
> | -- Configuring done (0.3s)
> | -- Generating done (0.0s)
> | -- Build files have been written to: /home/imun/projects/tarantool-luajit
> | $ cmake --build . --target LuaJIT-flake8
> | ninja: no work to do.
> | $ rm -f CMakeCache.txt
> | $ cmake .
> | -- The C compiler identification is GNU 13.2.0
> | -- Detecting C compiler ABI info
> | -- Detecting C compiler ABI info - done
> | -- Check for working C compiler: /usr/bin/cc - skipped
> | -- Detecting C compile features
> | -- Detecting C compile features - done
> | -- [SetVersion] Reading version from VCS: v2.1.0-beta3-355-g6dd0b0e2
> | -- [SetBuildParallelLevel] CMAKE_BUILD_PARALLEL_LEVEL is 4
> | -- The ASM compiler identification is GNU
> | -- Found assembler: /usr/bin/cc
> | -- Configuring done (0.3s)
> | -- Generating done (0.1s)
> | -- Build files have been written to: /home/imun/projects/tarantool-luajit
> | $ cmake --build . --target LuaJIT-flake8
> | `flake8' is not found, so LuaJIT-flake8 target is dummy
> | Built target LuaJIT-flake8
>
> Hence, I suggest to leave everything as is (see luacheck-related part),
> but in scope of the CTest series implement another way of interaction
> with user. Does it work for you?
Actually it doesn't work for me even with Ninja generator.
However, I don't want to block this patch due to this.
LGTM
>
>>> + )
>>> +endif()
>>> +
>>> +add_custom_target(${PROJECT_NAME}-lint DEPENDS
>>> + ${PROJECT_NAME}-luacheck
>>> + ${PROJECT_NAME}-flake8
>>> +)
>>> +
>>> set(LUAJIT_TEST_COMMAND "${LUAJIT_TEST_BINARY} -e dofile[[${LUAJIT_TEST_INIT}]]")
>>> separate_arguments(LUAJIT_TEST_COMMAND)
>> You've introduced a new target LuaJIT-lint, that includes LuaJIT-luacheck
>> and LuaJIT-flake8.
>>
>> I suppose we need replace dependence "LuaJIT-luacheck" to "LuaJIT-lint" for
>> a target "test".
> Oops, my bad, thanks! Fixed.
>
> ================================================================================
>
> diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt
> index 17ac5cac..58cba5ba 100644
> --- a/test/CMakeLists.txt
> +++ b/test/CMakeLists.txt
> @@ -102,6 +102,6 @@ if(LUAJIT_USE_TEST)
>
> add_custom_target(test DEPENDS
> ${PROJECT_NAME}-test
> - ${PROJECT_NAME}-luacheck
> + ${PROJECT_NAME}-lint
> )
> endif()
>
> ================================================================================
>
^ permalink raw reply [flat|nested] 68+ messages in thread
* Re: [Tarantool-patches] [PATCH luajit 15/15] test: run flake8 static analysis via CMake
2023-08-03 7:30 ` [Tarantool-patches] [PATCH luajit 15/15] test: run flake8 static analysis via CMake Igor Munkin via Tarantool-patches
2023-08-03 14:23 ` Sergey Bronnikov via Tarantool-patches
@ 2023-08-03 21:02 ` Maxim Kokryashkin via Tarantool-patches
2023-08-08 19:29 ` Igor Munkin via Tarantool-patches
1 sibling, 1 reply; 68+ messages in thread
From: Maxim Kokryashkin via Tarantool-patches @ 2023-08-03 21:02 UTC (permalink / raw)
To: Igor Munkin; +Cc: tarantool-patches
Hi, Igor!
Thanks for the patch!
Aside from comments left by Sergey, please consider a few of mine.
On Thu, Aug 03, 2023 at 07:30:40AM +0000, Igor Munkin wrote:
> This patch introduces a separate target to run flake8 against all Python
> scripts within LuaJIT repository (i.e. debugger extensions). There are
> some tweaks in .flake8rc regarding our style: one can find more info in
> the config file.
>
> The new target is a dependency for the new <LuaJIT-lint> target, that
> joins both luacheck and flake8 linter runs. CI job with linters is
> adjusted respectively.
>
> Signed-off-by: Igor Munkin <imun@tarantool.org>
> ---
> .flake8rc | 12 ++++++++++++
> .github/workflows/lint.yml | 4 ++--
> test/CMakeLists.txt | 28 ++++++++++++++++++++++++++++
> 3 files changed, 42 insertions(+), 2 deletions(-)
> create mode 100644 .flake8rc
>
> diff --git a/.flake8rc b/.flake8rc
> new file mode 100644
> index 00000000..b6f7ad48
> --- /dev/null
> +++ b/.flake8rc
> @@ -0,0 +1,12 @@
> +[flake8]
> +extend-ignore =
> + # TODO: I have no idea, how to fix this. flake8 suggests nothing
> + # (like clang-format or checkpatch.pl do). Help needed.
> + E131,
> + # TODO: I have no idea, how to fix this. flake8 suggests nothing
> + # (like clang-format or checkpatch.pl do). Help needed.
> + E501,
I dont't think we should disable the continuation line alignment rule (E131),
which has explanation in the docs[1] and the line length limit[2] (E501), which is
easily fixed.
> + # XXX: Suppress F821, since we have autogenerated names for
> + # 'ptr' type complements in luajit_lldb.py.
> + F821
> +max-line-length = 80
> diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml
> index 70c98104..6b420f68 100644
> --- a/.github/workflows/lint.yml
> +++ b/.github/workflows/lint.yml
> @@ -41,7 +41,7 @@ jobs:
> run: |
> # TODO: Move this step to a separate action.
> sudo apt -y update
> - sudo apt -y install cmake ninja-build lua5.1 luarocks
> + sudo apt -y install cmake ninja-build lua5.1 luarocks flake8
> sudo luarocks install luacheck
> # Set CMAKE_BUILD_PARALLEL_LEVEL environment variable to
> # limit the number of parallel jobs for build/test step.
> @@ -49,5 +49,5 @@ jobs:
> - name: configure
> run: cmake -S . -B ${{ env.BUILDDIR }} -G Ninja
> - name: test
> - run: cmake --build . --target LuaJIT-luacheck
> + run: cmake --build . --target LuaJIT-lint
> working-directory: ${{ env.BUILDDIR }}
> diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt
> index 47296a22..17ac5cac 100644
> --- a/test/CMakeLists.txt
> +++ b/test/CMakeLists.txt
> @@ -42,6 +42,34 @@ else()
> )
> endif()
>
> +find_program(FLAKE8 flake8)
> +if(FLAKE8)
> + get_filename_component(FLAKE8_SOURCE_DIR "${PROJECT_SOURCE_DIR}" REALPATH)
> + set(FLAKE8_RC ${FLAKE8_SOURCE_DIR}/.flake8rc)
> + file(GLOB_RECURSE FLAKE8_DEPS ${FLAKE8_SOURCE_DIR}/*.py)
> + add_custom_target(${PROJECT_NAME}-flake8
> + DEPENDS ${FLAKE8_DEPS}
> + )
> + add_custom_command(TARGET ${PROJECT_NAME}-flake8
> + COMMENT "Running flake8 static analysis"
> + COMMAND
> + ${FLAKE8} ${FLAKE8_DEPS}
> + --config ${FLAKE8_RC}
> + --jobs ${CMAKE_BUILD_PARALLEL_LEVEL}
> + WORKING_DIRECTORY ${FLAKE8_SOURCE_DIR}
> + )
I suggest moving this logic to a separate cmake module. It will
make the test/CMakeLists.txt cleaner and more readable.
> +else()
> + add_custom_target(${PROJECT_NAME}-flake8)
> + add_custom_command(TARGET ${PROJECT_NAME}-flake8
> + COMMENT "`flake8' is not found, so ${PROJECT_NAME}-flake8 target is dummy"
> + )
> +endif()
> +
> +add_custom_target(${PROJECT_NAME}-lint DEPENDS
> + ${PROJECT_NAME}-luacheck
> + ${PROJECT_NAME}-flake8
> +)
> +
> set(LUAJIT_TEST_COMMAND "${LUAJIT_TEST_BINARY} -e dofile[[${LUAJIT_TEST_INIT}]]")
> separate_arguments(LUAJIT_TEST_COMMAND)
>
> --
> 2.30.2
>
[1]: https://www.flake8rules.com/rules/E131.html
[2]: https://www.flake8rules.com/rules/E501.html
Best regards,
Maxim Kokryashkin
^ permalink raw reply [flat|nested] 68+ messages in thread
* Re: [Tarantool-patches] [PATCH luajit 15/15] test: run flake8 static analysis via CMake
2023-08-03 21:02 ` Maxim Kokryashkin via Tarantool-patches
@ 2023-08-08 19:29 ` Igor Munkin via Tarantool-patches
2023-08-08 19:42 ` [Tarantool-patches] [PATCH luajit 18/15] test: suppress E131 errors by pycodestyle Igor Munkin via Tarantool-patches
` (2 more replies)
0 siblings, 3 replies; 68+ messages in thread
From: Igor Munkin via Tarantool-patches @ 2023-08-08 19:29 UTC (permalink / raw)
To: Maxim Kokryashkin; +Cc: tarantool-patches
Max,
Thanks for your review! See my answers inline.
On 04.08.23, Maxim Kokryashkin wrote:
> Hi, Igor!
> Thanks for the patch!
>
> Aside from comments left by Sergey, please consider a few of mine.
>
> On Thu, Aug 03, 2023 at 07:30:40AM +0000, Igor Munkin wrote:
> > This patch introduces a separate target to run flake8 against all Python
> > scripts within LuaJIT repository (i.e. debugger extensions). There are
> > some tweaks in .flake8rc regarding our style: one can find more info in
> > the config file.
> >
> > The new target is a dependency for the new <LuaJIT-lint> target, that
> > joins both luacheck and flake8 linter runs. CI job with linters is
> > adjusted respectively.
> >
> > Signed-off-by: Igor Munkin <imun@tarantool.org>
> > ---
> > .flake8rc | 12 ++++++++++++
> > .github/workflows/lint.yml | 4 ++--
> > test/CMakeLists.txt | 28 ++++++++++++++++++++++++++++
> > 3 files changed, 42 insertions(+), 2 deletions(-)
> > create mode 100644 .flake8rc
> >
> > diff --git a/.flake8rc b/.flake8rc
> > new file mode 100644
> > index 00000000..b6f7ad48
> > --- /dev/null
> > +++ b/.flake8rc
> > @@ -0,0 +1,12 @@
> > +[flake8]
> > +extend-ignore =
> > + # TODO: I have no idea, how to fix this. flake8 suggests nothing
> > + # (like clang-format or checkpatch.pl do). Help needed.
> > + E131,
> > + # TODO: I have no idea, how to fix this. flake8 suggests nothing
> > + # (like clang-format or checkpatch.pl do). Help needed.
> > + E501,
> I dont't think we should disable the continuation line alignment rule (E131),
> which has explanation in the docs[1] and the line length limit[2] (E501), which is
> easily fixed.
*"I have no idea" why I decided to write that E131 is hard to fix...*
Maybe it's a brain damage as a result of solar flare, dunno.
All in all, I've marked all spots reported by flake8 with # noqa label
and here is why: All of the "misaligned" places are located deeply
inside a cascade of the calls and list comprehensions, so indenting the
tail of the comprehension with the same indent level as its beginning
makes the code barely readable at least for me. Yes, I have read enough
Python code and recently faced some sources with the "right"
indentation: it looks unreadable as fuck, since the only difference
between prefix and postfix <for> "statement" is the freaking colon. IMHO
the current indentation emphases the fact that this is a oneline
statement split into two lines due to the width limits. I know that
syntax error will occur if prefix variant is used instead of postfix and
vice versa, but we're talking about code formatting and readability. I
removed the global suppression and added inline suppressions in scope of
the separate commit (will send in reply to this message).
As for E501, I also rewrote some parts and finally fixed all occurrences
(will also send the patch in reply to this message).
New CI results here: https://github.com/tarantool/luajit/commit/f9c3849.
The diff for .flake8rc as a result of the aforementioned changes:
================================================================================
diff --git a/.flake8rc b/.flake8rc
index b6f7ad48..13e6178f 100644
--- a/.flake8rc
+++ b/.flake8rc
@@ -1,12 +1,5 @@
[flake8]
extend-ignore =
- # TODO: I have no idea, how to fix this. flake8 suggests nothing
- # (like clang-format or checkpatch.pl do). Help needed.
- E131,
- # TODO: I have no idea, how to fix this. flake8 suggests nothing
- # (like clang-format or checkpatch.pl do). Help needed.
- E501,
# XXX: Suppress F821, since we have autogenerated names for
# 'ptr' type complements in luajit_lldb.py.
F821
-max-line-length = 80
================================================================================
> > + # XXX: Suppress F821, since we have autogenerated names for
> > + # 'ptr' type complements in luajit_lldb.py.
> > + F821
> > +max-line-length = 80
<snipped>
> > diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt
> > index 47296a22..17ac5cac 100644
> > --- a/test/CMakeLists.txt
> > +++ b/test/CMakeLists.txt
> > @@ -42,6 +42,34 @@ else()
> > )
> > endif()
> >
> > +find_program(FLAKE8 flake8)
> > +if(FLAKE8)
> > + get_filename_component(FLAKE8_SOURCE_DIR "${PROJECT_SOURCE_DIR}" REALPATH)
> > + set(FLAKE8_RC ${FLAKE8_SOURCE_DIR}/.flake8rc)
> > + file(GLOB_RECURSE FLAKE8_DEPS ${FLAKE8_SOURCE_DIR}/*.py)
> > + add_custom_target(${PROJECT_NAME}-flake8
> > + DEPENDS ${FLAKE8_DEPS}
> > + )
> > + add_custom_command(TARGET ${PROJECT_NAME}-flake8
> > + COMMENT "Running flake8 static analysis"
> > + COMMAND
> > + ${FLAKE8} ${FLAKE8_DEPS}
> > + --config ${FLAKE8_RC}
> > + --jobs ${CMAKE_BUILD_PARALLEL_LEVEL}
> > + WORKING_DIRECTORY ${FLAKE8_SOURCE_DIR}
> > + )
> I suggest moving this logic to a separate cmake module. It will
> make the test/CMakeLists.txt cleaner and more readable.
Nice idea, thanks! However, I suggest to move it in scope of the series
integrating CTest (along with luacheck part). Does this work for you?
> > +else()
> > + add_custom_target(${PROJECT_NAME}-flake8)
> > + add_custom_command(TARGET ${PROJECT_NAME}-flake8
> > + COMMENT "`flake8' is not found, so ${PROJECT_NAME}-flake8 target is dummy"
> > + )
> > +endif()
> > +
> > +add_custom_target(${PROJECT_NAME}-lint DEPENDS
> > + ${PROJECT_NAME}-luacheck
> > + ${PROJECT_NAME}-flake8
> > +)
> > +
> > set(LUAJIT_TEST_COMMAND "${LUAJIT_TEST_BINARY} -e dofile[[${LUAJIT_TEST_INIT}]]")
> > separate_arguments(LUAJIT_TEST_COMMAND)
> >
> > --
> > 2.30.2
> >
> [1]: https://www.flake8rules.com/rules/E131.html
> [2]: https://www.flake8rules.com/rules/E501.html
>
> Best regards,
> Maxim Kokryashkin
--
Best regards,
IM
^ permalink raw reply [flat|nested] 68+ messages in thread
* [Tarantool-patches] [PATCH luajit 18/15] test: suppress E131 errors by pycodestyle
2023-08-08 19:29 ` Igor Munkin via Tarantool-patches
@ 2023-08-08 19:42 ` Igor Munkin via Tarantool-patches
2023-08-13 13:52 ` Maxim Kokryashkin via Tarantool-patches
2023-08-08 19:42 ` [Tarantool-patches] [PATCH luajit 19/15] test: fix E501 " Igor Munkin via Tarantool-patches
2023-08-14 7:28 ` [Tarantool-patches] [PATCH luajit 15/15] test: run flake8 static analysis via CMake Maxim Kokryashkin via Tarantool-patches
2 siblings, 1 reply; 68+ messages in thread
From: Igor Munkin via Tarantool-patches @ 2023-08-08 19:42 UTC (permalink / raw)
To: Maxim Kokryashkin, Sergey Bronnikov; +Cc: tarantool-patches
Suppressed 4 occurrences of E131 ("continuation line unaligned for
hanging indent") error reported by pycodestyle[1]. The reasons, why
these violations are not fixed the way recommended in the docs are
below:
* The only difference between prefix and postfix loop statements (the
latter is used in various generators and comprehensions) is the
trailing colon.
* The surrounding code is quite complex consisting of the cascade of the
calls and list comprehensions.
Hence, to emphasis the postfix loop used in list comprehensions,
additional indent is preserved and inline <noqa> suppressions are added.
[1]: https://www.flake8rules.com/rules/E131.html
Signed-off-by: Igor Munkin <imun@tarantool.org>
---
**NB**: This patch will be placed between "[PATCH luajit 02/15] test:
fix E128 errors by pycodestyle" and "[PATCH luajit 03/15] test: fix E201
and E202 errors by pycodestyle" on the branch.
CI: https://github.com/tarantool/luajit/actions/runs/5800936024/job/15724104222
src/luajit-gdb.py | 4 ++--
src/luajit_lldb.py | 4 ++--
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/src/luajit-gdb.py b/src/luajit-gdb.py
index f9623e53..9dcddb17 100644
--- a/src/luajit-gdb.py
+++ b/src/luajit-gdb.py
@@ -553,7 +553,7 @@ def dump_stack(L, base=None, top=None):
]
dump.extend([
dump_stack_slot(L, maxstack + offset, base, top)
- for offset in range(red, 0, -1)
+ for offset in range(red, 0, -1) # noqa: E131
])
dump.extend([
'{padding} Stack: {nstackslots: >5} slots {padding}'.format(
@@ -572,7 +572,7 @@ def dump_stack(L, base=None, top=None):
# Dump all data slots in the (framelink, top) interval.
dump.extend([
dump_stack_slot(L, framelink + offset, base, top)
- for offset in range(frametop - framelink, 0, -1)
+ for offset in range(frametop - framelink, 0, -1) # noqa: E131
])
# Dump frame slot (2 slots in case of GC64).
dump.append(dump_framelink(L, framelink))
diff --git a/src/luajit_lldb.py b/src/luajit_lldb.py
index 53f3abca..13d9f2e3 100644
--- a/src/luajit_lldb.py
+++ b/src/luajit_lldb.py
@@ -844,7 +844,7 @@ def dump_stack(L, base=None, top=None):
]
dump.extend([
dump_stack_slot(L, maxstack + offset, base, top)
- for offset in range(red, 0, -1)
+ for offset in range(red, 0, -1) # noqa: E131
])
dump.extend([
'{padding} Stack: {nstackslots: >5} slots {padding}'.format(
@@ -864,7 +864,7 @@ def dump_stack(L, base=None, top=None):
# Dump all data slots in the (framelink, top) interval.
dump.extend([
dump_stack_slot(L, framelink + offset, base, top)
- for offset in range(frametop - framelink, 0, -1)
+ for offset in range(frametop - framelink, 0, -1) # noqa: E131
])
# Dump frame slot (2 slots in case of GC64).
dump.append(dump_framelink(L, framelink))
--
2.30.2
^ permalink raw reply [flat|nested] 68+ messages in thread
* Re: [Tarantool-patches] [PATCH luajit 18/15] test: suppress E131 errors by pycodestyle
2023-08-08 19:42 ` [Tarantool-patches] [PATCH luajit 18/15] test: suppress E131 errors by pycodestyle Igor Munkin via Tarantool-patches
@ 2023-08-13 13:52 ` Maxim Kokryashkin via Tarantool-patches
0 siblings, 0 replies; 68+ messages in thread
From: Maxim Kokryashkin via Tarantool-patches @ 2023-08-13 13:52 UTC (permalink / raw)
To: Igor Munkin; +Cc: tarantool-patches
Hi, Igor!
Thanks for the patch!
LGTM, except for a few typos below.
On Tue, Aug 08, 2023 at 07:42:39PM +0000, Igor Munkin wrote:
> Suppressed 4 occurrences of E131 ("continuation line unaligned for
Typo: s/of/of the/
> hanging indent") error reported by pycodestyle[1]. The reasons, why
> these violations are not fixed the way recommended in the docs are
> below:
> * The only difference between prefix and postfix loop statements (the
> latter is used in various generators and comprehensions) is the
> trailing colon.
> * The surrounding code is quite complex consisting of the cascade of the
> calls and list comprehensions.
>
> Hence, to emphasis the postfix loop used in list comprehensions,
Typo: s/to emphasis/to emphasize/
> additional indent is preserved and inline <noqa> suppressions are added.
>
> [1]: https://www.flake8rules.com/rules/E131.html
>
> Signed-off-by: Igor Munkin <imun@tarantool.org>
> ---
>
> **NB**: This patch will be placed between "[PATCH luajit 02/15] test:
> fix E128 errors by pycodestyle" and "[PATCH luajit 03/15] test: fix E201
> and E202 errors by pycodestyle" on the branch.
>
> CI: https://github.com/tarantool/luajit/actions/runs/5800936024/job/15724104222
>
> src/luajit-gdb.py | 4 ++--
> src/luajit_lldb.py | 4 ++--
> 2 files changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/src/luajit-gdb.py b/src/luajit-gdb.py
> index f9623e53..9dcddb17 100644
> --- a/src/luajit-gdb.py
> +++ b/src/luajit-gdb.py
> @@ -553,7 +553,7 @@ def dump_stack(L, base=None, top=None):
> ]
> dump.extend([
> dump_stack_slot(L, maxstack + offset, base, top)
> - for offset in range(red, 0, -1)
> + for offset in range(red, 0, -1) # noqa: E131
> ])
> dump.extend([
> '{padding} Stack: {nstackslots: >5} slots {padding}'.format(
> @@ -572,7 +572,7 @@ def dump_stack(L, base=None, top=None):
> # Dump all data slots in the (framelink, top) interval.
> dump.extend([
> dump_stack_slot(L, framelink + offset, base, top)
> - for offset in range(frametop - framelink, 0, -1)
> + for offset in range(frametop - framelink, 0, -1) # noqa: E131
> ])
> # Dump frame slot (2 slots in case of GC64).
> dump.append(dump_framelink(L, framelink))
> diff --git a/src/luajit_lldb.py b/src/luajit_lldb.py
> index 53f3abca..13d9f2e3 100644
> --- a/src/luajit_lldb.py
> +++ b/src/luajit_lldb.py
> @@ -844,7 +844,7 @@ def dump_stack(L, base=None, top=None):
> ]
> dump.extend([
> dump_stack_slot(L, maxstack + offset, base, top)
> - for offset in range(red, 0, -1)
> + for offset in range(red, 0, -1) # noqa: E131
> ])
> dump.extend([
> '{padding} Stack: {nstackslots: >5} slots {padding}'.format(
> @@ -864,7 +864,7 @@ def dump_stack(L, base=None, top=None):
> # Dump all data slots in the (framelink, top) interval.
> dump.extend([
> dump_stack_slot(L, framelink + offset, base, top)
> - for offset in range(frametop - framelink, 0, -1)
> + for offset in range(frametop - framelink, 0, -1) # noqa: E131
> ])
> # Dump frame slot (2 slots in case of GC64).
> dump.append(dump_framelink(L, framelink))
> --
> 2.30.2
>
Best regards,
Maxim Kokryashkin
^ permalink raw reply [flat|nested] 68+ messages in thread
* [Tarantool-patches] [PATCH luajit 19/15] test: fix E501 errors by pycodestyle
2023-08-08 19:29 ` Igor Munkin via Tarantool-patches
2023-08-08 19:42 ` [Tarantool-patches] [PATCH luajit 18/15] test: suppress E131 errors by pycodestyle Igor Munkin via Tarantool-patches
@ 2023-08-08 19:42 ` Igor Munkin via Tarantool-patches
2023-08-13 13:55 ` Maxim Kokryashkin via Tarantool-patches
2023-08-14 7:28 ` [Tarantool-patches] [PATCH luajit 15/15] test: run flake8 static analysis via CMake Maxim Kokryashkin via Tarantool-patches
2 siblings, 1 reply; 68+ messages in thread
From: Igor Munkin via Tarantool-patches @ 2023-08-08 19:42 UTC (permalink / raw)
To: Maxim Kokryashkin, Sergey Bronnikov; +Cc: tarantool-patches
Fixed 11 occurrences of E501 ("line too long") error reported by
pycodestyle[1].
[1]: https://www.flake8rules.com/rules/E501.html
Signed-off-by: Igor Munkin <imun@tarantool.org>
---
**NB**: This patch will be placed between "[PATCH luajit 10/15] test:
fix E305 errors by pycodestyle" and "[PATCH luajit 11/15] test: fix E502
errors by pycodestyle" on the branch.
CI: https://github.com/tarantool/luajit/actions/runs/5800936024/job/15724104222
src/luajit-gdb.py | 4 ++--
src/luajit_lldb.py | 55 +++++++++++++++++++++++++---------------------
2 files changed, 32 insertions(+), 27 deletions(-)
diff --git a/src/luajit-gdb.py b/src/luajit-gdb.py
index 9dcddb17..5eaf250f 100644
--- a/src/luajit-gdb.py
+++ b/src/luajit-gdb.py
@@ -430,9 +430,9 @@ def dump_lj_tfunc(tv):
if ffid == 0:
pt = funcproto(func)
- return 'Lua function @ {addr}, {nupvals} upvalues, {chunk}:{line}'.format(
+ return 'Lua function @ {addr}, {nups} upvalues, {chunk}:{line}'.format(
addr=strx64(func),
- nupvals=int(func['nupvalues']),
+ nups=int(func['nupvalues']),
chunk=strdata(cast('GCstr *', gcval(pt['chunkname']))),
line=pt['firstline']
)
diff --git a/src/luajit_lldb.py b/src/luajit_lldb.py
index 13d9f2e3..ef0986cc 100644
--- a/src/luajit_lldb.py
+++ b/src/luajit_lldb.py
@@ -50,10 +50,11 @@ class Ptr:
if isinstance(other, int):
return self.__add__(-other)
else:
- return int((self.value.unsigned - other.value.unsigned) / sizeof(self.normal_type.__name__))
+ return int((self.value.unsigned - other.value.unsigned)
+ / sizeof(self.normal_type.__name__))
def __eq__(self, other):
- assert isinstance(other, Ptr) or (isinstance(other, int) and other >= 0)
+ assert isinstance(other, Ptr) or isinstance(other, int) and other >= 0
if isinstance(other, Ptr):
return self.value.unsigned == other.value.unsigned
else:
@@ -126,10 +127,12 @@ class Struct(metaclass=MetaStruct):
c_structs = {
'MRef': [
- (property(lambda self: self['ptr64'].unsigned if LJ_GC64 else self['ptr32'].unsigned), 'ptr')
+ (property(lambda self: self['ptr64'].unsigned if LJ_GC64
+ else self['ptr32'].unsigned), 'ptr')
],
'GCRef': [
- (property(lambda self: self['gcptr64'].unsigned if LJ_GC64 else self['gcptr32'].unsigned), 'gcptr')
+ (property(lambda self: self['gcptr64'].unsigned if LJ_GC64
+ else self['gcptr32'].unsigned), 'gcptr')
],
'TValue': [
('GCRef', 'gcr'),
@@ -137,8 +140,9 @@ c_structs = {
('uint', 'i'),
('int', 'it64'),
('string', 'n'),
- (property(lambda self: self['ftsz'].signed if LJ_GC64 else None), 'ftsz'),
- (property(lambda self: FR(self['fr']) if not LJ_GC64 else None), 'fr')
+ (property(lambda self: FR(self['fr']) if not LJ_GC64 else None), 'fr'),
+ (property(lambda self: self['ftsz'].signed if LJ_GC64 else None),
+ 'ftsz')
],
'GCState': [
('GCRef', 'root'),
@@ -223,16 +227,10 @@ for cls in c_structs.keys():
for cls in Struct.__subclasses__():
ptr_name = cls.__name__ + 'Ptr'
- def make_ptr_init(nm, cls):
- return type(
- nm,
- (Ptr,),
- {
- '__init__': lambda self, value: super(type(self), self).__init__(value, cls)
- }
- )
-
- globals()[ptr_name] = make_ptr_init(ptr_name, cls)
+ globals()[ptr_name] = type(ptr_name, (Ptr,), {
+ '__init__':
+ lambda self, value: super(type(self), self).__init__(value, cls)
+ })
class Command(object):
@@ -590,9 +588,9 @@ def dump_lj_tfunc(tv):
if ffid == 0:
pt = funcproto(func)
- return 'Lua function @ {addr}, {nupvals} upvalues, {chunk}:{line}'.format(
+ return 'Lua function @ {addr}, {nups} upvalues, {chunk}:{line}'.format(
addr=strx64(func),
- nupvals=func.nupvalues,
+ nups=func.nupvalues,
chunk=strdata(cast(GCstrPtr, gcval(pt.chunkname))),
line=pt.firstline
)
@@ -737,7 +735,8 @@ def frame_prevl(framelink):
# a struct member of 32-bit type to 64-bit type without getting onto
# the next property bits, despite the fact that it's an actual value, not
# a pointer to it.
- return framelink - (1 + LJ_FR2 + bc_a(vtou64(dbg_eval('((BCIns *)' + str(frame_pc(framelink)) + ')[-1]'))))
+ bcins = vtou64(dbg_eval('((BCIns *)' + str(frame_pc(framelink)) + ')[-1]'))
+ return framelink - (1 + LJ_FR2 + bc_a(bcins))
def frame_ispcall(framelink):
@@ -852,10 +851,15 @@ def dump_stack(L, base=None, top=None):
nstackslots=int((maxstack - stack) >> 3),
),
dump_stack_slot(L, maxstack, base, top),
- '{start:{padding}}:{end:{padding}} [ ] {nfreeslots} slots: Free stack slots'.format(
- start=strx64(top + 1),
- end=strx64(maxstack - 1),
- padding=len(PADDING),
+ '{start}:{end} [ ] {nfreeslots} slots: Free stack slots'.format(
+ start='{address:{padding}}'.format(
+ address=strx64(top + 1),
+ padding=len(PADDING),
+ ),
+ end='{address:{padding}}'.format(
+ address=strx64(maxstack - 1),
+ padding=len(PADDING),
+ ),
nfreeslots=int((maxstack - top - 8) >> 3),
),
])
@@ -1075,9 +1079,10 @@ def register_commands(debugger, commands):
for command, cls in commands.items():
cls.command = command
debugger.HandleCommand(
- 'command script add --overwrite --class luajit_lldb.{cls} {command}'.format(
+ 'command script add --overwrite --class luajit_lldb.{cls} {cmd}'
+ .format(
cls=cls.__name__,
- command=cls.command,
+ cmd=cls.command,
)
)
print('{cmd} command intialized'.format(cmd=cls.command))
--
2.30.2
^ permalink raw reply [flat|nested] 68+ messages in thread
* Re: [Tarantool-patches] [PATCH luajit 19/15] test: fix E501 errors by pycodestyle
2023-08-08 19:42 ` [Tarantool-patches] [PATCH luajit 19/15] test: fix E501 " Igor Munkin via Tarantool-patches
@ 2023-08-13 13:55 ` Maxim Kokryashkin via Tarantool-patches
0 siblings, 0 replies; 68+ messages in thread
From: Maxim Kokryashkin via Tarantool-patches @ 2023-08-13 13:55 UTC (permalink / raw)
To: Igor Munkin; +Cc: tarantool-patches
Hi, Igor!
Thanks for the patch!
LGTM
On Tue, Aug 08, 2023 at 07:42:40PM +0000, Igor Munkin wrote:
> Fixed 11 occurrences of E501 ("line too long") error reported by
> pycodestyle[1].
>
> [1]: https://www.flake8rules.com/rules/E501.html
>
> Signed-off-by: Igor Munkin <imun@tarantool.org>
> ---
>
> **NB**: This patch will be placed between "[PATCH luajit 10/15] test:
> fix E305 errors by pycodestyle" and "[PATCH luajit 11/15] test: fix E502
> errors by pycodestyle" on the branch.
>
> CI: https://github.com/tarantool/luajit/actions/runs/5800936024/job/15724104222
>
> src/luajit-gdb.py | 4 ++--
> src/luajit_lldb.py | 55 +++++++++++++++++++++++++---------------------
> 2 files changed, 32 insertions(+), 27 deletions(-)
>
> diff --git a/src/luajit-gdb.py b/src/luajit-gdb.py
> index 9dcddb17..5eaf250f 100644
> --- a/src/luajit-gdb.py
> +++ b/src/luajit-gdb.py
> @@ -430,9 +430,9 @@ def dump_lj_tfunc(tv):
>
> if ffid == 0:
> pt = funcproto(func)
> - return 'Lua function @ {addr}, {nupvals} upvalues, {chunk}:{line}'.format(
> + return 'Lua function @ {addr}, {nups} upvalues, {chunk}:{line}'.format(
> addr=strx64(func),
> - nupvals=int(func['nupvalues']),
> + nups=int(func['nupvalues']),
> chunk=strdata(cast('GCstr *', gcval(pt['chunkname']))),
> line=pt['firstline']
> )
> diff --git a/src/luajit_lldb.py b/src/luajit_lldb.py
> index 13d9f2e3..ef0986cc 100644
> --- a/src/luajit_lldb.py
> +++ b/src/luajit_lldb.py
> @@ -50,10 +50,11 @@ class Ptr:
> if isinstance(other, int):
> return self.__add__(-other)
> else:
> - return int((self.value.unsigned - other.value.unsigned) / sizeof(self.normal_type.__name__))
> + return int((self.value.unsigned - other.value.unsigned)
> + / sizeof(self.normal_type.__name__))
>
> def __eq__(self, other):
> - assert isinstance(other, Ptr) or (isinstance(other, int) and other >= 0)
> + assert isinstance(other, Ptr) or isinstance(other, int) and other >= 0
> if isinstance(other, Ptr):
> return self.value.unsigned == other.value.unsigned
> else:
> @@ -126,10 +127,12 @@ class Struct(metaclass=MetaStruct):
>
> c_structs = {
> 'MRef': [
> - (property(lambda self: self['ptr64'].unsigned if LJ_GC64 else self['ptr32'].unsigned), 'ptr')
> + (property(lambda self: self['ptr64'].unsigned if LJ_GC64
> + else self['ptr32'].unsigned), 'ptr')
> ],
> 'GCRef': [
> - (property(lambda self: self['gcptr64'].unsigned if LJ_GC64 else self['gcptr32'].unsigned), 'gcptr')
> + (property(lambda self: self['gcptr64'].unsigned if LJ_GC64
> + else self['gcptr32'].unsigned), 'gcptr')
> ],
> 'TValue': [
> ('GCRef', 'gcr'),
> @@ -137,8 +140,9 @@ c_structs = {
> ('uint', 'i'),
> ('int', 'it64'),
> ('string', 'n'),
> - (property(lambda self: self['ftsz'].signed if LJ_GC64 else None), 'ftsz'),
> - (property(lambda self: FR(self['fr']) if not LJ_GC64 else None), 'fr')
> + (property(lambda self: FR(self['fr']) if not LJ_GC64 else None), 'fr'),
> + (property(lambda self: self['ftsz'].signed if LJ_GC64 else None),
> + 'ftsz')
> ],
> 'GCState': [
> ('GCRef', 'root'),
> @@ -223,16 +227,10 @@ for cls in c_structs.keys():
> for cls in Struct.__subclasses__():
> ptr_name = cls.__name__ + 'Ptr'
>
> - def make_ptr_init(nm, cls):
> - return type(
> - nm,
> - (Ptr,),
> - {
> - '__init__': lambda self, value: super(type(self), self).__init__(value, cls)
> - }
> - )
> -
> - globals()[ptr_name] = make_ptr_init(ptr_name, cls)
> + globals()[ptr_name] = type(ptr_name, (Ptr,), {
> + '__init__':
> + lambda self, value: super(type(self), self).__init__(value, cls)
> + })
>
>
> class Command(object):
> @@ -590,9 +588,9 @@ def dump_lj_tfunc(tv):
>
> if ffid == 0:
> pt = funcproto(func)
> - return 'Lua function @ {addr}, {nupvals} upvalues, {chunk}:{line}'.format(
> + return 'Lua function @ {addr}, {nups} upvalues, {chunk}:{line}'.format(
> addr=strx64(func),
> - nupvals=func.nupvalues,
> + nups=func.nupvalues,
> chunk=strdata(cast(GCstrPtr, gcval(pt.chunkname))),
> line=pt.firstline
> )
> @@ -737,7 +735,8 @@ def frame_prevl(framelink):
> # a struct member of 32-bit type to 64-bit type without getting onto
> # the next property bits, despite the fact that it's an actual value, not
> # a pointer to it.
> - return framelink - (1 + LJ_FR2 + bc_a(vtou64(dbg_eval('((BCIns *)' + str(frame_pc(framelink)) + ')[-1]'))))
> + bcins = vtou64(dbg_eval('((BCIns *)' + str(frame_pc(framelink)) + ')[-1]'))
> + return framelink - (1 + LJ_FR2 + bc_a(bcins))
>
>
> def frame_ispcall(framelink):
> @@ -852,10 +851,15 @@ def dump_stack(L, base=None, top=None):
> nstackslots=int((maxstack - stack) >> 3),
> ),
> dump_stack_slot(L, maxstack, base, top),
> - '{start:{padding}}:{end:{padding}} [ ] {nfreeslots} slots: Free stack slots'.format(
> - start=strx64(top + 1),
> - end=strx64(maxstack - 1),
> - padding=len(PADDING),
> + '{start}:{end} [ ] {nfreeslots} slots: Free stack slots'.format(
> + start='{address:{padding}}'.format(
> + address=strx64(top + 1),
> + padding=len(PADDING),
> + ),
> + end='{address:{padding}}'.format(
> + address=strx64(maxstack - 1),
> + padding=len(PADDING),
> + ),
> nfreeslots=int((maxstack - top - 8) >> 3),
> ),
> ])
> @@ -1075,9 +1079,10 @@ def register_commands(debugger, commands):
> for command, cls in commands.items():
> cls.command = command
> debugger.HandleCommand(
> - 'command script add --overwrite --class luajit_lldb.{cls} {command}'.format(
> + 'command script add --overwrite --class luajit_lldb.{cls} {cmd}'
> + .format(
> cls=cls.__name__,
> - command=cls.command,
> + cmd=cls.command,
> )
> )
> print('{cmd} command intialized'.format(cmd=cls.command))
> --
> 2.30.2
>
Best regards,
Maxim Kokryashkin
^ permalink raw reply [flat|nested] 68+ messages in thread
* Re: [Tarantool-patches] [PATCH luajit 15/15] test: run flake8 static analysis via CMake
2023-08-08 19:29 ` Igor Munkin via Tarantool-patches
2023-08-08 19:42 ` [Tarantool-patches] [PATCH luajit 18/15] test: suppress E131 errors by pycodestyle Igor Munkin via Tarantool-patches
2023-08-08 19:42 ` [Tarantool-patches] [PATCH luajit 19/15] test: fix E501 " Igor Munkin via Tarantool-patches
@ 2023-08-14 7:28 ` Maxim Kokryashkin via Tarantool-patches
2 siblings, 0 replies; 68+ messages in thread
From: Maxim Kokryashkin via Tarantool-patches @ 2023-08-14 7:28 UTC (permalink / raw)
To: Igor Munkin; +Cc: tarantool-patches
Hi, Igor!
Thanks for the fixes!
LGTM. Also, see my comments below.
On Tue, Aug 08, 2023 at 07:29:47PM +0000, Igor Munkin wrote:
> Max,
>
> Thanks for your review! See my answers inline.
>
> On 04.08.23, Maxim Kokryashkin wrote:
> > Hi, Igor!
> > Thanks for the patch!
> >
> > Aside from comments left by Sergey, please consider a few of mine.
> >
> > On Thu, Aug 03, 2023 at 07:30:40AM +0000, Igor Munkin wrote:
> > > This patch introduces a separate target to run flake8 against all Python
> > > scripts within LuaJIT repository (i.e. debugger extensions). There are
> > > some tweaks in .flake8rc regarding our style: one can find more info in
> > > the config file.
> > >
> > > The new target is a dependency for the new <LuaJIT-lint> target, that
> > > joins both luacheck and flake8 linter runs. CI job with linters is
> > > adjusted respectively.
> > >
> > > Signed-off-by: Igor Munkin <imun@tarantool.org>
> > > ---
> > > .flake8rc | 12 ++++++++++++
> > > .github/workflows/lint.yml | 4 ++--
> > > test/CMakeLists.txt | 28 ++++++++++++++++++++++++++++
> > > 3 files changed, 42 insertions(+), 2 deletions(-)
> > > create mode 100644 .flake8rc
> > >
> > > diff --git a/.flake8rc b/.flake8rc
> > > new file mode 100644
> > > index 00000000..b6f7ad48
> > > --- /dev/null
> > > +++ b/.flake8rc
> > > @@ -0,0 +1,12 @@
> > > +[flake8]
> > > +extend-ignore =
> > > + # TODO: I have no idea, how to fix this. flake8 suggests nothing
> > > + # (like clang-format or checkpatch.pl do). Help needed.
> > > + E131,
> > > + # TODO: I have no idea, how to fix this. flake8 suggests nothing
> > > + # (like clang-format or checkpatch.pl do). Help needed.
> > > + E501,
> > I dont't think we should disable the continuation line alignment rule (E131),
> > which has explanation in the docs[1] and the line length limit[2] (E501), which is
> > easily fixed.
>
> *"I have no idea" why I decided to write that E131 is hard to fix...*
> Maybe it's a brain damage as a result of solar flare, dunno.
>
> All in all, I've marked all spots reported by flake8 with # noqa label
> and here is why: All of the "misaligned" places are located deeply
> inside a cascade of the calls and list comprehensions, so indenting the
> tail of the comprehension with the same indent level as its beginning
> makes the code barely readable at least for me. Yes, I have read enough
> Python code and recently faced some sources with the "right"
> indentation: it looks unreadable as fuck, since the only difference
> between prefix and postfix <for> "statement" is the freaking colon. IMHO
> the current indentation emphases the fact that this is a oneline
> statement split into two lines due to the width limits. I know that
> syntax error will occur if prefix variant is used instead of postfix and
> vice versa, but we're talking about code formatting and readability. I
> removed the global suppression and added inline suppressions in scope of
> the separate commit (will send in reply to this message).
>
> As for E501, I also rewrote some parts and finally fixed all occurrences
> (will also send the patch in reply to this message).
>
> New CI results here: https://github.com/tarantool/luajit/commit/f9c3849.
> The diff for .flake8rc as a result of the aforementioned changes:
>
> ================================================================================
>
> diff --git a/.flake8rc b/.flake8rc
> index b6f7ad48..13e6178f 100644
> --- a/.flake8rc
> +++ b/.flake8rc
> @@ -1,12 +1,5 @@
> [flake8]
> extend-ignore =
> - # TODO: I have no idea, how to fix this. flake8 suggests nothing
> - # (like clang-format or checkpatch.pl do). Help needed.
> - E131,
> - # TODO: I have no idea, how to fix this. flake8 suggests nothing
> - # (like clang-format or checkpatch.pl do). Help needed.
> - E501,
> # XXX: Suppress F821, since we have autogenerated names for
> # 'ptr' type complements in luajit_lldb.py.
> F821
> -max-line-length = 80
>
> ================================================================================
Awesome! Thanks for the fixes!
>
> > > + # XXX: Suppress F821, since we have autogenerated names for
> > > + # 'ptr' type complements in luajit_lldb.py.
> > > + F821
> > > +max-line-length = 80
>
> <snipped>
>
> > > diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt
> > > index 47296a22..17ac5cac 100644
> > > --- a/test/CMakeLists.txt
> > > +++ b/test/CMakeLists.txt
> > > @@ -42,6 +42,34 @@ else()
> > > )
> > > endif()
> > >
> > > +find_program(FLAKE8 flake8)
> > > +if(FLAKE8)
> > > + get_filename_component(FLAKE8_SOURCE_DIR "${PROJECT_SOURCE_DIR}" REALPATH)
> > > + set(FLAKE8_RC ${FLAKE8_SOURCE_DIR}/.flake8rc)
> > > + file(GLOB_RECURSE FLAKE8_DEPS ${FLAKE8_SOURCE_DIR}/*.py)
> > > + add_custom_target(${PROJECT_NAME}-flake8
> > > + DEPENDS ${FLAKE8_DEPS}
> > > + )
> > > + add_custom_command(TARGET ${PROJECT_NAME}-flake8
> > > + COMMENT "Running flake8 static analysis"
> > > + COMMAND
> > > + ${FLAKE8} ${FLAKE8_DEPS}
> > > + --config ${FLAKE8_RC}
> > > + --jobs ${CMAKE_BUILD_PARALLEL_LEVEL}
> > > + WORKING_DIRECTORY ${FLAKE8_SOURCE_DIR}
> > > + )
> > I suggest moving this logic to a separate cmake module. It will
> > make the test/CMakeLists.txt cleaner and more readable.
>
> Nice idea, thanks! However, I suggest to move it in scope of the series
> integrating CTest (along with luacheck part). Does this work for you?
Personally, I see no reason to postpone it and wait some for some kind
of 'refactoring' patch. However, if you believe it'll make the history
more consistent, then feel free to ignore.
>
> > > +else()
> > > + add_custom_target(${PROJECT_NAME}-flake8)
> > > + add_custom_command(TARGET ${PROJECT_NAME}-flake8
> > > + COMMENT "`flake8' is not found, so ${PROJECT_NAME}-flake8 target is dummy"
> > > + )
> > > +endif()
> > > +
> > > +add_custom_target(${PROJECT_NAME}-lint DEPENDS
> > > + ${PROJECT_NAME}-luacheck
> > > + ${PROJECT_NAME}-flake8
> > > +)
> > > +
> > > set(LUAJIT_TEST_COMMAND "${LUAJIT_TEST_BINARY} -e dofile[[${LUAJIT_TEST_INIT}]]")
> > > separate_arguments(LUAJIT_TEST_COMMAND)
> > >
> > > --
> > > 2.30.2
> > >
> > [1]: https://www.flake8rules.com/rules/E131.html
> > [2]: https://www.flake8rules.com/rules/E501.html
> >
> > Best regards,
> > Maxim Kokryashkin
>
> --
> Best regards,
> IM
^ permalink raw reply [flat|nested] 68+ messages in thread
* Re: [Tarantool-patches] [PATCH luajit 00/15] Add flake8 linter
2023-08-03 7:30 [Tarantool-patches] [PATCH luajit 00/15] Add flake8 linter Igor Munkin via Tarantool-patches
` (14 preceding siblings ...)
2023-08-03 7:30 ` [Tarantool-patches] [PATCH luajit 15/15] test: run flake8 static analysis via CMake Igor Munkin via Tarantool-patches
@ 2023-08-21 11:05 ` Igor Munkin via Tarantool-patches
15 siblings, 0 replies; 68+ messages in thread
From: Igor Munkin via Tarantool-patches @ 2023-08-21 11:05 UTC (permalink / raw)
To: Maxim Kokryashkin, Sergey Bronnikov; +Cc: tarantool-patches
Pals, thanks for your reviews!
I've checked the patchset into all long-term branches in
tarantool/luajit and bumped a new version in master, release/2.11 and
release/2.10.
On 03.08.23, Igor Munkin wrote:
> This series implements flak8 linter support for existing Python scripts
> in the repo (i.e. luajit-gdb.py and luajit_lldb.py). Almost all patches
> simply fix PEP8 violations found in our code, and the last patch of the
> series adds flake8 config, CMake subtarget to run flake8 in scope of the
> new <LuaJIT-lint> target and adjusts lint workflow respectively.
>
> To be honest, not all of the errors reported by flake8 (or rather
> pycodestyle that is wrapped by flake8) are fixed at the moment. One can
> find some TODO entries in .flake8rc, since I've failed making flake8
> happy and have finally given up. If you have any ideas how to resolve
> these TODOs, you're very welcome.
>
> Branch: https://github.com/tarantool/luajit/commits/imun/add-flake8
>
> Igor Munkin (15):
> test: fix E122 errors by pycodestyle
> test: fix E128 errors by pycodestyle
> test: fix E201 and E202 errors by pycodestyle
> test: fix E203 errors by pycodestyle
> test: fix E231 errors by pycodestyle
> test: fix E251 errors by pycodestyle
> test: fix E301 errors by pycodestyle
> test: fix E302 errors by pycodestyle
> test: fix E303 errors by pycodestyle
> test: fix E305 errors by pycodestyle
> test: fix E502 errors by pycodestyle
> test: fix E711 errors by pycodestyle
> test: fix E722 errors by pycodestyle
> test: fix E741 errors by pycodestyle
> test: run flake8 static analysis via CMake
>
> .flake8rc | 12 ++
> .github/workflows/lint.yml | 4 +-
> src/luajit-gdb.py | 325 ++++++++++++++++++++++-------------
> src/luajit_lldb.py | 336 +++++++++++++++++++++++--------------
> test/CMakeLists.txt | 28 ++++
> 5 files changed, 458 insertions(+), 247 deletions(-)
> create mode 100644 .flake8rc
>
> --
> 2.30.2
>
--
Best regards,
IM
^ permalink raw reply [flat|nested] 68+ messages in thread