All of lore.kernel.org
 help / color / mirror / Atom feed
* [PULL 0/3] QAPI patches patches for 2023-11-13
@ 2023-11-13 10:34 Markus Armbruster
  2023-11-13 10:34 ` [PULL 1/3] qapi: Fix QAPISchemaEntity.__repr__() Markus Armbruster
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Markus Armbruster @ 2023-11-13 10:34 UTC (permalink / raw)
  To: qemu-devel; +Cc: stefanha

The following changes since commit 69680740eafa1838527c90155a7432d51b8ff203:

  Merge tag 'qdev-array-prop' of https://repo.or.cz/qemu/kevin into staging (2023-11-11 11:23:25 +0800)

are available in the Git repository at:

  https://repo.or.cz/qemu/armbru.git tags/pull-qapi-2023-11-13

for you to fetch changes up to 5c24c3e2f3b22f1b77d556a14dd3bb8deed1f976:

  tests/qapi-schema: Tidy up pylint warnings and advice (2023-11-13 10:36:51 +0100)

----------------------------------------------------------------
QAPI patches patches for 2023-11-13

----------------------------------------------------------------
Markus Armbruster (3):
      qapi: Fix QAPISchemaEntity.__repr__()
      sphinx/qapidoc: Tidy up pylint warning raise-missing-from
      tests/qapi-schema: Tidy up pylint warnings and advice

 docs/sphinx/qapidoc.py         | 2 +-
 scripts/qapi/schema.py         | 3 ++-
 tests/qapi-schema/test-qapi.py | 9 ++++-----
 3 files changed, 7 insertions(+), 7 deletions(-)

Markus Armbruster (3):
  qapi: Fix QAPISchemaEntity.__repr__()
  sphinx/qapidoc: Tidy up pylint warning raise-missing-from
  tests/qapi-schema: Tidy up pylint warnings and advice

 docs/sphinx/qapidoc.py         | 2 +-
 scripts/qapi/schema.py         | 3 ++-
 tests/qapi-schema/test-qapi.py | 9 ++++-----
 3 files changed, 7 insertions(+), 7 deletions(-)

-- 
2.41.0



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

* [PULL 1/3] qapi: Fix QAPISchemaEntity.__repr__()
  2023-11-13 10:34 [PULL 0/3] QAPI patches patches for 2023-11-13 Markus Armbruster
@ 2023-11-13 10:34 ` Markus Armbruster
  2023-11-13 10:34 ` [PULL 2/3] sphinx/qapidoc: Tidy up pylint warning raise-missing-from Markus Armbruster
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: Markus Armbruster @ 2023-11-13 10:34 UTC (permalink / raw)
  To: qemu-devel
  Cc: stefanha, Daniel P . Berrangé, Philippe Mathieu-Daudé

I messed it up on merge.  It's a debugging aid, so no impact on build.

Fixes: e307a8174bb8 (qapi: provide a friendly string representation of QAPI classes)
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Message-ID: <20231024104841.1569250-1-armbru@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
 scripts/qapi/schema.py | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/scripts/qapi/schema.py b/scripts/qapi/schema.py
index d739e558e9..6a836950a9 100644
--- a/scripts/qapi/schema.py
+++ b/scripts/qapi/schema.py
@@ -76,7 +76,8 @@ def __init__(self, name: str, info, doc, ifcond=None, features=None):
     def __repr__(self):
         if self.name is None:
             return "<%s at 0x%x>" % (type(self).__name__, id(self))
-        return "<%s:%s at 0x%x>" % type(self).__name__, self.name, id(self)
+        return "<%s:%s at 0x%x>" % (type(self).__name__, self.name,
+                                    id(self))
 
     def c_name(self):
         return c_name(self.name)
-- 
2.41.0



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

* [PULL 2/3] sphinx/qapidoc: Tidy up pylint warning raise-missing-from
  2023-11-13 10:34 [PULL 0/3] QAPI patches patches for 2023-11-13 Markus Armbruster
  2023-11-13 10:34 ` [PULL 1/3] qapi: Fix QAPISchemaEntity.__repr__() Markus Armbruster
@ 2023-11-13 10:34 ` Markus Armbruster
  2023-11-13 10:34 ` [PULL 3/3] tests/qapi-schema: Tidy up pylint warnings and advice Markus Armbruster
  2023-11-13 19:27 ` [PULL 0/3] QAPI patches patches for 2023-11-13 Stefan Hajnoczi
  3 siblings, 0 replies; 5+ messages in thread
From: Markus Armbruster @ 2023-11-13 10:34 UTC (permalink / raw)
  To: qemu-devel; +Cc: stefanha, John Snow

Pylint advises:

    docs/sphinx/qapidoc.py:518:12: W0707: Consider explicitly re-raising using 'raise ExtensionError(str(err)) from err' (raise-missing-from)

>From its manual:

    Python's exception chaining shows the traceback of the current
    exception, but also of the original exception.  When you raise a
    new exception after another exception was caught it's likely that
    the second exception is a friendly re-wrapping of the first
    exception.  In such cases `raise from` provides a better link
    between the two tracebacks in the final error.

Makes sense, so do it.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Message-ID: <20231025092159.1782638-2-armbru@redhat.com>
Reviewed-by: John Snow <jsnow@redhat.com>
---
 docs/sphinx/qapidoc.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/docs/sphinx/qapidoc.py b/docs/sphinx/qapidoc.py
index 8f3b9997a1..658c288f8f 100644
--- a/docs/sphinx/qapidoc.py
+++ b/docs/sphinx/qapidoc.py
@@ -515,7 +515,7 @@ def run(self):
         except QAPIError as err:
             # Launder QAPI parse errors into Sphinx extension errors
             # so they are displayed nicely to the user
-            raise ExtensionError(str(err))
+            raise ExtensionError(str(err)) from err
 
     def do_parse(self, rstlist, node):
         """Parse rST source lines and add them to the specified node
-- 
2.41.0



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

* [PULL 3/3] tests/qapi-schema: Tidy up pylint warnings and advice
  2023-11-13 10:34 [PULL 0/3] QAPI patches patches for 2023-11-13 Markus Armbruster
  2023-11-13 10:34 ` [PULL 1/3] qapi: Fix QAPISchemaEntity.__repr__() Markus Armbruster
  2023-11-13 10:34 ` [PULL 2/3] sphinx/qapidoc: Tidy up pylint warning raise-missing-from Markus Armbruster
@ 2023-11-13 10:34 ` Markus Armbruster
  2023-11-13 19:27 ` [PULL 0/3] QAPI patches patches for 2023-11-13 Stefan Hajnoczi
  3 siblings, 0 replies; 5+ messages in thread
From: Markus Armbruster @ 2023-11-13 10:34 UTC (permalink / raw)
  To: qemu-devel; +Cc: stefanha, John Snow

Pylint warns:

    tests/qapi-schema/test-qapi.py:139:13: W1514: Using open without explicitly specifying an encoding (unspecified-encoding)
    tests/qapi-schema/test-qapi.py:143:13: W1514: Using open without explicitly specifying an encoding (unspecified-encoding)

Add encoding='utf-8'.

Pylint advises:

    tests/qapi-schema/test-qapi.py:143:13: R1732: Consider using 'with' for resource-allocating operations (consider-using-with)

Silence this by returning the value directly.

Pylint advises:

    tests/qapi-schema/test-qapi.py:221:4: R1722: Consider using sys.exit() (consider-using-sys-exit)
    tests/qapi-schema/test-qapi.py:226:4: R1722: Consider using sys.exit() (consider-using-sys-exit)

Sure, why not.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Message-ID: <20231025092925.1785934-1-armbru@redhat.com>
Reviewed-by: John Snow <jsnow@redhat.com>
---
 tests/qapi-schema/test-qapi.py | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/tests/qapi-schema/test-qapi.py b/tests/qapi-schema/test-qapi.py
index d58c31f539..14f7b62a44 100755
--- a/tests/qapi-schema/test-qapi.py
+++ b/tests/qapi-schema/test-qapi.py
@@ -136,12 +136,11 @@ def test_frontend(fname):
 def open_test_result(dir_name, file_name, update):
     mode = 'r+' if update else 'r'
     try:
-        fp = open(os.path.join(dir_name, file_name), mode)
+        return open(os.path.join(dir_name, file_name), mode, encoding='utf-8')
     except FileNotFoundError:
         if not update:
             raise
-        fp = open(os.path.join(dir_name, file_name), 'w+')
-    return fp
+    return open(os.path.join(dir_name, file_name), 'w+', encoding='utf-8')
 
 
 def test_and_diff(test_name, dir_name, update):
@@ -218,9 +217,9 @@ def main(argv):
         test_name = os.path.splitext(base_name)[0]
         status |= test_and_diff(test_name, dir_name, args.update)
 
-    exit(status)
+    sys.exit(status)
 
 
 if __name__ == '__main__':
     main(sys.argv)
-    exit(0)
+    sys.exit(0)
-- 
2.41.0



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

* Re: [PULL 0/3] QAPI patches patches for 2023-11-13
  2023-11-13 10:34 [PULL 0/3] QAPI patches patches for 2023-11-13 Markus Armbruster
                   ` (2 preceding siblings ...)
  2023-11-13 10:34 ` [PULL 3/3] tests/qapi-schema: Tidy up pylint warnings and advice Markus Armbruster
@ 2023-11-13 19:27 ` Stefan Hajnoczi
  3 siblings, 0 replies; 5+ messages in thread
From: Stefan Hajnoczi @ 2023-11-13 19:27 UTC (permalink / raw)
  To: Markus Armbruster; +Cc: qemu-devel, stefanha

[-- Attachment #1: Type: text/plain, Size: 115 bytes --]

Applied, thanks.

Please update the changelog at https://wiki.qemu.org/ChangeLog/8.2 for any user-visible changes.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

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

end of thread, other threads:[~2023-11-13 19:29 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-11-13 10:34 [PULL 0/3] QAPI patches patches for 2023-11-13 Markus Armbruster
2023-11-13 10:34 ` [PULL 1/3] qapi: Fix QAPISchemaEntity.__repr__() Markus Armbruster
2023-11-13 10:34 ` [PULL 2/3] sphinx/qapidoc: Tidy up pylint warning raise-missing-from Markus Armbruster
2023-11-13 10:34 ` [PULL 3/3] tests/qapi-schema: Tidy up pylint warnings and advice Markus Armbruster
2023-11-13 19:27 ` [PULL 0/3] QAPI patches patches for 2023-11-13 Stefan Hajnoczi

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.