* [PATCH] treewide: python-scripts: use `is None` for none-equality
@ 2024-02-18 20:02 Konstantin Kharlamov
2024-02-20 13:17 ` Adhemerval Zanella Netto
0 siblings, 1 reply; 3+ messages in thread
From: Konstantin Kharlamov @ 2024-02-18 20:02 UTC (permalink / raw)
To: libc-alpha
Testing for `None`-ness with `==` operator is frowned upon and causes
warnings in at least "LGTM" python linter. Fix that.
Signed-off-by: Konstantin Kharlamov <Hi-Angel@yandex.ru>
---
math/gen-tgmath-tests.py | 6 +++---
nptl/nptl-printers.py | 2 +-
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/math/gen-tgmath-tests.py b/math/gen-tgmath-tests.py
index 216e4640ef..d3a7f65899 100755
--- a/math/gen-tgmath-tests.py
+++ b/math/gen-tgmath-tests.py
@@ -414,7 +414,7 @@ class Tests(object):
elif ret == 'g' or 'g' in args:
# Real and complex.
have_complex = True
- if complex_func == None:
+ if complex_func is None:
complex_func = 'c%s' % func
# For narrowing macros, compute narrow_args, the list of
# argument types for which there is an actual corresponding
@@ -462,7 +462,7 @@ class Tests(object):
continue
if t.complex and not have_complex:
continue
- if func == None and not t.complex:
+ if func is None and not t.complex:
continue
if ret == 's' and t.name.startswith('_Float'):
continue
@@ -544,7 +544,7 @@ class Tests(object):
all_conds.append(can_comb)
if narrowing:
all_conds.append(narrow_cond)
- any_complex = func == None
+ any_complex = func is None
for t in this_args:
if t.complex:
any_complex = True
diff --git a/nptl/nptl-printers.py b/nptl/nptl-printers.py
index 41d1a76c65..fc9d39d70c 100644
--- a/nptl/nptl-printers.py
+++ b/nptl/nptl-printers.py
@@ -587,7 +587,7 @@ def register(objfile):
printer.add_printer('pthread_rwlockattr_t', r'^pthread_rwlockattr_t$',
RWLockAttributesPrinter)
- if objfile == None:
+ if objfile is None:
objfile = gdb
gdb.printing.register_pretty_printer(objfile, printer)
--
2.43.0
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] treewide: python-scripts: use `is None` for none-equality
2024-02-18 20:02 [PATCH] treewide: python-scripts: use `is None` for none-equality Konstantin Kharlamov
@ 2024-02-20 13:17 ` Adhemerval Zanella Netto
2024-02-22 6:30 ` Konstantin Kharlamov
0 siblings, 1 reply; 3+ messages in thread
From: Adhemerval Zanella Netto @ 2024-02-20 13:17 UTC (permalink / raw)
To: Konstantin Kharlamov, libc-alpha
On 18/02/24 17:02, Konstantin Kharlamov wrote:
> Testing for `None`-ness with `==` operator is frowned upon and causes
> warnings in at least "LGTM" python linter. Fix that.
>
> Signed-off-by: Konstantin Kharlamov <Hi-Angel@yandex.ru>
LGTM, thanks.
Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
> ---
> math/gen-tgmath-tests.py | 6 +++---
> nptl/nptl-printers.py | 2 +-
> 2 files changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/math/gen-tgmath-tests.py b/math/gen-tgmath-tests.py
> index 216e4640ef..d3a7f65899 100755
> --- a/math/gen-tgmath-tests.py
> +++ b/math/gen-tgmath-tests.py
> @@ -414,7 +414,7 @@ class Tests(object):
> elif ret == 'g' or 'g' in args:
> # Real and complex.
> have_complex = True
> - if complex_func == None:
> + if complex_func is None:
> complex_func = 'c%s' % func
> # For narrowing macros, compute narrow_args, the list of
> # argument types for which there is an actual corresponding
> @@ -462,7 +462,7 @@ class Tests(object):
> continue
> if t.complex and not have_complex:
> continue
> - if func == None and not t.complex:
> + if func is None and not t.complex:
> continue
> if ret == 's' and t.name.startswith('_Float'):
> continue
> @@ -544,7 +544,7 @@ class Tests(object):
> all_conds.append(can_comb)
> if narrowing:
> all_conds.append(narrow_cond)
> - any_complex = func == None
> + any_complex = func is None
> for t in this_args:
> if t.complex:
> any_complex = True
> diff --git a/nptl/nptl-printers.py b/nptl/nptl-printers.py
> index 41d1a76c65..fc9d39d70c 100644
> --- a/nptl/nptl-printers.py
> +++ b/nptl/nptl-printers.py
> @@ -587,7 +587,7 @@ def register(objfile):
> printer.add_printer('pthread_rwlockattr_t', r'^pthread_rwlockattr_t$',
> RWLockAttributesPrinter)
>
> - if objfile == None:
> + if objfile is None:
> objfile = gdb
>
> gdb.printing.register_pretty_printer(objfile, printer)
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] treewide: python-scripts: use `is None` for none-equality
2024-02-20 13:17 ` Adhemerval Zanella Netto
@ 2024-02-22 6:30 ` Konstantin Kharlamov
0 siblings, 0 replies; 3+ messages in thread
From: Konstantin Kharlamov @ 2024-02-22 6:30 UTC (permalink / raw)
To: Adhemerval Zanella Netto, libc-alpha
On Tue, 2024-02-20 at 10:17 -0300, Adhemerval Zanella Netto wrote:
>
>
> On 18/02/24 17:02, Konstantin Kharlamov wrote:
> > Testing for `None`-ness with `==` operator is frowned upon and
> > causes
> > warnings in at least "LGTM" python linter. Fix that.
> >
> > Signed-off-by: Konstantin Kharlamov <Hi-Angel@yandex.ru>
>
> LGTM, thanks.
>
> Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Thank you! So, I don't have write permissions, what do I do nowadays to
have it pushed to the repo? Do I resend the patch with R-b? How does it
work now?
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2024-02-22 6:30 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-02-18 20:02 [PATCH] treewide: python-scripts: use `is None` for none-equality Konstantin Kharlamov
2024-02-20 13:17 ` Adhemerval Zanella Netto
2024-02-22 6:30 ` Konstantin Kharlamov
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).