@samitouri / QOSamiQemu / commits / d678c5aff3

qapi/parser: remove unused QAPIDoc subsection members

All users of the QAPIDoc object should be iterating over all_sections and not grabbing arbitrary subsections, if possible. Remove the 'body' and 'sections' members, as they are no longer used. Signed-off-by: John Snow <jsnow@redhat.com> Reviewed-by: Markus Armbruster <armbru@redhat.com> Message-ID: <20260611042332.482979-4-jsnow@redhat.com> Reviewed-by: Markus Armbruster <armbru@redhat.com> [Commit message tweaked] Signed-off-by: Markus Armbruster <armbru@redhat.com>

John Snow committed Jun 11, 2026 at 00:23 UTC d678c5aff318f2c5feefd983ea01a8b456541e93
1 file changed -6
scripts/qapi/parser.py
-6
@@ -732,8 +732,6 @@ class QAPIDoc:
732 self.all_sections: List[QAPIDoc.Section] = [
733 QAPIDoc.Section(info, QAPIDoc.Kind.PLAIN)
734 ]
735 - # the body section
736 - self.body: Optional[QAPIDoc.Section] = self.all_sections[0]
735 # dicts mapping parameter/feature names to their description
736 self.args: Dict[str, QAPIDoc.ArgSection] = {}
737 self.features: Dict[str, QAPIDoc.ArgSection] = {}
@@ -742,8 +740,6 @@ class QAPIDoc:
740 self.errors: Optional[QAPIDoc.Section] = None
741 # "Since" section
742 self.since: Optional[QAPIDoc.Section] = None
745 - # sections other than .body, .args, .features
746 - self.sections: List[QAPIDoc.Section] = []
743
744 def end(self) -> None:
745 for section in self.all_sections:
@@ -766,7 +762,6 @@ class QAPIDoc:
762
763 # start new section
764 section = self.Section(info, kind)
769 - self.sections.append(section)
765 self.all_sections.append(section)
766
767 def new_tagged_section(
@@ -790,7 +785,6 @@ class QAPIDoc:
785 raise QAPISemError(
786 info, "duplicated '%s' section" % kind)
787 self.since = section
793 - self.sections.append(section)
788 self.all_sections.append(section)
789
790 def _new_description(