diff mbox series

[11/14] qapi/doc.py: Don't use private attributes of QAPIGen property

Message ID 20200922211802.4083666-12-jsnow@redhat.com
State New
Headers show
Series qapi: static typing conversion, pt3 | expand

Commit Message

John Snow Sept. 22, 2020, 9:17 p.m. UTC
Use the new __bool__ method to do the same without exposing the private
attribute.

Signed-off-by: John Snow <jsnow@redhat.com>
---
 scripts/qapi/doc.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Eduardo Habkost Sept. 23, 2020, 9:05 p.m. UTC | #1
On Tue, Sep 22, 2020 at 05:17:59PM -0400, John Snow wrote:
> Use the new __bool__ method to do the same without exposing the private

> attribute.

> 

> Signed-off-by: John Snow <jsnow@redhat.com>


Reviewed-by: Eduardo Habkost <ehabkost@redhat.com>


-- 
Eduardo
diff mbox series

Patch

diff --git a/scripts/qapi/doc.py b/scripts/qapi/doc.py
index 5f2b0cd51d..2914e93b1c 100644
--- a/scripts/qapi/doc.py
+++ b/scripts/qapi/doc.py
@@ -344,7 +344,7 @@  def visit_event(self,
         self._gen.add(texi_msg('Event', doc, ifcond, members))
 
     def symbol(self, doc: QAPIDoc, entity: QAPISchemaEntity) -> None:
-        if self._gen._body:
+        if self._gen:
             self._gen.add('\n')
         self.cur_doc = doc
         entity.visit(self)
@@ -352,7 +352,7 @@  def symbol(self, doc: QAPIDoc, entity: QAPISchemaEntity) -> None:
 
     def freeform(self, doc: QAPIDoc) -> None:
         assert not doc.args
-        if self._gen._body:
+        if self._gen:
             self._gen.add('\n')
         self._gen.add(texi_body(doc) + texi_sections(doc, None))