If printing a QAPI schema object for debugging we get the classname and
a hex value for the instance:

  <qapi.schema.QAPISchemaEnumType object at 0x7f0ab4c2dad0>
  <qapi.schema.QAPISchemaObjectType object at 0x7f0ab4c2dd90>
  <qapi.schema.QAPISchemaArrayType object at 0x7f0ab4c2df90>

With this change we instead get the classname and the human friendly
name of the QAPI type instance:


Signed-off-by: Daniel P. Berrangé <berra...@redhat.com>

v1 was two & half years ago:


 scripts/qapi/schema.py | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/scripts/qapi/schema.py b/scripts/qapi/schema.py
index 231ebf61ba..20ffacbdf0 100644
--- a/scripts/qapi/schema.py
+++ b/scripts/qapi/schema.py
@@ -73,6 +73,12 @@ def __init__(self, name: str, info, doc, ifcond=None, 
         self.features = features or []
         self._checked = False
+    def __repr__(self):
+        if self.name is not None:
+            return "<%s:%s>" % (type(self).__name__, self.name)
+        else:
+            return "<%s>" % type(self).__name__
     def c_name(self):
         return c_name(self.name)

Reply via email to