aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--docs/sphinx/qapidoc.py2
-rw-r--r--scripts/qapi/schema.py3
-rwxr-xr-xtests/qapi-schema/test-qapi.py9
3 files changed, 7 insertions, 7 deletions
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 @@ class QAPIDocDirective(Directive):
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
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 @@ class QAPISchemaEntity:
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)
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)