public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] Update gdb to black 22.6.0
@ 2022-07-14 18:41 Tom Tromey
  2022-07-15  1:13 ` Simon Marchi
  0 siblings, 1 reply; 3+ messages in thread
From: Tom Tromey @ 2022-07-14 18:41 UTC (permalink / raw)
  To: gdb-patches; +Cc: Tom Tromey

I couldn't get black 21.12b0 to work correctly -- it always errored,
even with just "--version" -- so instead I make a virtualenv with the
latest release.  Running it on gdb yielded two minor changes.
---
 gdb/python/lib/gdb/__init__.py             | 7 ++++---
 gdb/testsuite/gdb.python/py-send-packet.py | 6 ++++--
 2 files changed, 8 insertions(+), 5 deletions(-)

diff --git a/gdb/python/lib/gdb/__init__.py b/gdb/python/lib/gdb/__init__.py
index 9e9978ef30e..5b10e3e2381 100644
--- a/gdb/python/lib/gdb/__init__.py
+++ b/gdb/python/lib/gdb/__init__.py
@@ -30,7 +30,8 @@ from _gdb import *
 # Historically, gdb.events was always available, so ensure it's
 # still available without an explicit import.
 import _gdbevents as events
-sys.modules['gdb.events'] = events
+
+sys.modules["gdb.events"] = events
 
 
 class _GdbFile(object):
@@ -243,9 +244,9 @@ def set_parameter(name, value):
     # can return them, but they can't be passed to 'set' this way.
     if isinstance(value, bool):
         if value:
-            value = 'on'
+            value = "on"
         else:
-            value = 'off'
+            value = "off"
     execute("set " + name + " " + str(value), to_string=True)
 
 
diff --git a/gdb/testsuite/gdb.python/py-send-packet.py b/gdb/testsuite/gdb.python/py-send-packet.py
index ae70b852538..26deeb1e40d 100644
--- a/gdb/testsuite/gdb.python/py-send-packet.py
+++ b/gdb/testsuite/gdb.python/py-send-packet.py
@@ -114,10 +114,12 @@ def check_global_var(expected_val):
     if val != expected_val:
         raise gdb.GdbError("global_var is 0x%x, expected 0x%x" % (val, expected_val))
 
+
 # Return a bytes object representing an 'X' packet header with
 # address ADDR.
-def xpacket_header (addr):
-    return ("X%x,4:" % addr).encode('ascii')
+def xpacket_header(addr):
+    return ("X%x,4:" % addr).encode("ascii")
+
 
 # Set the 'X' packet to the remote target to set a global variable.
 # Checks that we can send byte values.
-- 
2.34.1


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] Update gdb to black 22.6.0
  2022-07-14 18:41 [PATCH] Update gdb to black 22.6.0 Tom Tromey
@ 2022-07-15  1:13 ` Simon Marchi
  2022-07-15 13:56   ` Tom Tromey
  0 siblings, 1 reply; 3+ messages in thread
From: Simon Marchi @ 2022-07-15  1:13 UTC (permalink / raw)
  To: Tom Tromey, gdb-patches



On 2022-07-14 14:41, Tom Tromey via Gdb-patches wrote:
> I couldn't get black 21.12b0 to work correctly -- it always errored,
> even with just "--version" -- so instead I make a virtualenv with the
> latest release.  Running it on gdb yielded two minor changes.
> ---
>  gdb/python/lib/gdb/__init__.py             | 7 ++++---
>  gdb/testsuite/gdb.python/py-send-packet.py | 6 ++++--
>  2 files changed, 8 insertions(+), 5 deletions(-)
> 
> diff --git a/gdb/python/lib/gdb/__init__.py b/gdb/python/lib/gdb/__init__.py
> index 9e9978ef30e..5b10e3e2381 100644
> --- a/gdb/python/lib/gdb/__init__.py
> +++ b/gdb/python/lib/gdb/__init__.py
> @@ -30,7 +30,8 @@ from _gdb import *
>  # Historically, gdb.events was always available, so ensure it's
>  # still available without an explicit import.
>  import _gdbevents as events
> -sys.modules['gdb.events'] = events
> +
> +sys.modules["gdb.events"] = events
>  
>  
>  class _GdbFile(object):
> @@ -243,9 +244,9 @@ def set_parameter(name, value):
>      # can return them, but they can't be passed to 'set' this way.
>      if isinstance(value, bool):
>          if value:
> -            value = 'on'
> +            value = "on"
>          else:
> -            value = 'off'
> +            value = "off"
>      execute("set " + name + " " + str(value), to_string=True)
>  
>  
> diff --git a/gdb/testsuite/gdb.python/py-send-packet.py b/gdb/testsuite/gdb.python/py-send-packet.py
> index ae70b852538..26deeb1e40d 100644
> --- a/gdb/testsuite/gdb.python/py-send-packet.py
> +++ b/gdb/testsuite/gdb.python/py-send-packet.py
> @@ -114,10 +114,12 @@ def check_global_var(expected_val):
>      if val != expected_val:
>          raise gdb.GdbError("global_var is 0x%x, expected 0x%x" % (val, expected_val))
>  
> +
>  # Return a bytes object representing an 'X' packet header with
>  # address ADDR.
> -def xpacket_header (addr):
> -    return ("X%x,4:" % addr).encode('ascii')
> +def xpacket_header(addr):
> +    return ("X%x,4:" % addr).encode("ascii")
> +
>  
>  # Set the 'X' packet to the remote target to set a global variable.
>  # Checks that we can send byte values.

FWIW, these changes are not related to using a new black version, they
are cases of people not running black in previous patches.  I am able to
run black 21.12.b0, and it yields the exact same changes.

Note that in the wiki, I wrote "Use the latest available black
version", the goal is not to pin a version.  If you notice some changes
when running the latest version of black, just push a trivial patch.

Simon

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] Update gdb to black 22.6.0
  2022-07-15  1:13 ` Simon Marchi
@ 2022-07-15 13:56   ` Tom Tromey
  0 siblings, 0 replies; 3+ messages in thread
From: Tom Tromey @ 2022-07-15 13:56 UTC (permalink / raw)
  To: Simon Marchi; +Cc: Tom Tromey, gdb-patches

Simon> FWIW, these changes are not related to using a new black version, they
Simon> are cases of people not running black in previous patches.  I am able to
Simon> run black 21.12.b0, and it yields the exact same changes.

Alright, thanks.  I couldn't be sure.
I've updated the commit message & I'm going to check it in.

Tom

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-07-15 13:56 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-07-14 18:41 [PATCH] Update gdb to black 22.6.0 Tom Tromey
2022-07-15  1:13 ` Simon Marchi
2022-07-15 13:56   ` Tom Tromey

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).