get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

GET /api/1.1/patches/2221164/?format=api
HTTP 200 OK
Allow: GET, PUT, PATCH, HEAD, OPTIONS
Content-Type: application/json
Vary: Accept

{
    "id": 2221164,
    "url": "http://patchwork.ozlabs.org/api/1.1/patches/2221164/?format=api",
    "web_url": "http://patchwork.ozlabs.org/project/qemu-devel/patch/20260408045531.3006678-9-jsnow@redhat.com/",
    "project": {
        "id": 14,
        "url": "http://patchwork.ozlabs.org/api/1.1/projects/14/?format=api",
        "name": "QEMU Development",
        "link_name": "qemu-devel",
        "list_id": "qemu-devel.nongnu.org",
        "list_email": "qemu-devel@nongnu.org",
        "web_url": "",
        "scm_url": "",
        "webscm_url": ""
    },
    "msgid": "<20260408045531.3006678-9-jsnow@redhat.com>",
    "date": "2026-04-08T04:55:29",
    "name": "[v2,08/10] qapi: enforce doc block section ordering",
    "commit_ref": null,
    "pull_url": null,
    "state": "new",
    "archived": false,
    "hash": "c6404f3e9d55e1f2d0a42e660c70e42899f3a7e8",
    "submitter": {
        "id": 64343,
        "url": "http://patchwork.ozlabs.org/api/1.1/people/64343/?format=api",
        "name": "John Snow",
        "email": "jsnow@redhat.com"
    },
    "delegate": null,
    "mbox": "http://patchwork.ozlabs.org/project/qemu-devel/patch/20260408045531.3006678-9-jsnow@redhat.com/mbox/",
    "series": [
        {
            "id": 499174,
            "url": "http://patchwork.ozlabs.org/api/1.1/series/499174/?format=api",
            "web_url": "http://patchwork.ozlabs.org/project/qemu-devel/list/?series=499174",
            "date": "2026-04-08T04:55:23",
            "name": "qapi: enforce section ordering",
            "version": 2,
            "mbox": "http://patchwork.ozlabs.org/series/499174/mbox/"
        }
    ],
    "comments": "http://patchwork.ozlabs.org/api/patches/2221164/comments/",
    "check": "pending",
    "checks": "http://patchwork.ozlabs.org/api/patches/2221164/checks/",
    "tags": {},
    "headers": {
        "Return-Path": "<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>",
        "X-Original-To": "incoming@patchwork.ozlabs.org",
        "Delivered-To": "patchwork-incoming@legolas.ozlabs.org",
        "Authentication-Results": [
            "legolas.ozlabs.org;\n\tdkim=pass (1024-bit key;\n unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256\n header.s=mimecast20190719 header.b=R57vrxix;\n\tdkim-atps=neutral",
            "legolas.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org\n (client-ip=209.51.188.17; helo=lists.gnu.org;\n envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org;\n receiver=patchwork.ozlabs.org)"
        ],
        "Received": [
            "from lists.gnu.org (lists1p.gnu.org [209.51.188.17])\n\t(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))\n\t(No client certificate requested)\n\tby legolas.ozlabs.org (Postfix) with ESMTPS id 4frYC86Mrsz1yD6\n\tfor <incoming@patchwork.ozlabs.org>; Thu, 09 Apr 2026 05:33:40 +1000 (AEST)",
            "from localhost ([::1] helo=lists1p.gnu.org)\n\tby lists.gnu.org with esmtp (Exim 4.90_1)\n\t(envelope-from <qemu-devel-bounces@nongnu.org>)\n\tid 1wAYW1-0005qL-Fl; Wed, 08 Apr 2026 15:24:41 -0400",
            "from eggs.gnu.org ([2001:470:142:3::10])\n by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)\n (Exim 4.90_1) (envelope-from <jsnow@redhat.com>) id 1wAY6p-0007CZ-Rn\n for qemu-devel@nongnu.org; Wed, 08 Apr 2026 14:58:39 -0400",
            "from us-smtp-delivery-124.mimecast.com ([170.10.133.124])\n by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)\n (Exim 4.90_1) (envelope-from <jsnow@redhat.com>) id 1wAKyL-0005YE-Ir\n for qemu-devel@nongnu.org; Wed, 08 Apr 2026 00:57:02 -0400",
            "from mx-prod-mc-05.mail-002.prod.us-west-2.aws.redhat.com\n (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by\n relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3,\n cipher=TLS_AES_256_GCM_SHA384) id us-mta-316-tqP6xa1QO76yhAtKpQnmcg-1; Wed,\n 08 Apr 2026 00:56:59 -0400",
            "from mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com\n (mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.12])\n (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest\n SHA256)\n (No client certificate requested)\n by mx-prod-mc-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS\n id 4E70A195609D; Wed,  8 Apr 2026 04:56:57 +0000 (UTC)",
            "from jsnow-thinkpadp16vgen1.westford.csb (unknown [10.22.88.7])\n by mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP\n id 54BCB19560A6; Wed,  8 Apr 2026 04:56:47 +0000 (UTC)"
        ],
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com;\n s=mimecast20190719; t=1775624221;\n h=from:from:reply-to:subject:subject:date:date:message-id:message-id:\n to:to:cc:cc:mime-version:mime-version:\n content-transfer-encoding:content-transfer-encoding:\n in-reply-to:in-reply-to:references:references;\n bh=12Ibako9l1QCgj1DoburL3oW+TWB9fRmzv8J5Z9tONs=;\n b=R57vrxixTkm1JrPrKfAIo+dwzVhXm7IBSmjNaScOu+5uBLdrinemGhM3JcymGb/l2RWH23\n equJJc1OSJJ2uWP/XXICA/OEp34pqDcIhjKPvauFatYKfFAlePVnOAAhFs2elqZxiPMivr\n 2flf9ARXQmvN1ypWsD/QIZj5maoktVE=",
        "X-MC-Unique": "tqP6xa1QO76yhAtKpQnmcg-1",
        "X-Mimecast-MFC-AGG-ID": "tqP6xa1QO76yhAtKpQnmcg_1775624217",
        "From": "John Snow <jsnow@redhat.com>",
        "To": "qemu-devel@nongnu.org",
        "Cc": "Kashyap Chamarthy <kchamart@redhat.com>,\n Stefan Berger <stefanb@linux.vnet.ibm.com>,\n Mauro Carvalho Chehab <mchehab+huawei@kernel.org>,\n Michael Roth <michael.roth@amd.com>,\n =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= <philmd@linaro.org>,\n qemu-block@nongnu.org, Pierrick Bouvier <pierrick.bouvier@linaro.org>,\n Yanan Wang <wangyanan55@huawei.com>, Hanna Reitz <hreitz@redhat.com>,\n Peter Xu <peterx@redhat.com>, Igor Mammedov <imammedo@redhat.com>,\n \"Michael S. Tsirkin\" <mst@redhat.com>, Kevin Wolf <kwolf@redhat.com>,\n\t=?utf-8?q?Marc-Andr=C3=A9_Lureau?= <marcandre.lureau@redhat.com>,\n Stefano Garzarella <sgarzare@redhat.com>, =?utf-8?q?Daniel_P=2E_Berrang?=\n\t=?utf-8?q?=C3=A9?= <berrange@redhat.com>, Lukas Straub <lukasstraub2@web.de>,\n Jason Wang <jasowang@redhat.com>, Alex Williamson <alex@shazbot.org>,\n Paolo Bonzini <pbonzini@redhat.com>, Fabiano Rosas <farosas@suse.de>,\n Zhao Liu <zhao1.liu@intel.com>,\n Richard Henderson <richard.henderson@linaro.org>, =?utf-8?q?C=C3=A9dric_Le_?=\n\t=?utf-8?q?Goater?= <clg@redhat.com>, Stefan Hajnoczi <stefanha@redhat.com>,\n Peter Maydell <peter.maydell@linaro.org>, Eric Blake <eblake@redhat.com>,\n\t=?utf-8?q?Alex_Benn=C3=A9e?= <alex.bennee@linaro.org>,\n Kostiantyn Kostiuk <kkostiuk@redhat.com>, Jiri Pirko <jiri@resnulli.us>,\n Markus Armbruster <armbru@redhat.com>, John Snow <jsnow@redhat.com>,\n Ani Sinha <anisinha@redhat.com>,\n Marcel Apfelbaum <marcel.apfelbaum@gmail.com>",
        "Subject": "[PATCH v2 08/10] qapi: enforce doc block section ordering",
        "Date": "Wed,  8 Apr 2026 00:55:29 -0400",
        "Message-ID": "<20260408045531.3006678-9-jsnow@redhat.com>",
        "In-Reply-To": "<20260408045531.3006678-1-jsnow@redhat.com>",
        "References": "<20260408045531.3006678-1-jsnow@redhat.com>",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "8bit",
        "X-Scanned-By": "MIMEDefang 3.0 on 10.30.177.12",
        "Received-SPF": "pass client-ip=170.10.133.124; envelope-from=jsnow@redhat.com;\n helo=us-smtp-delivery-124.mimecast.com",
        "X-Spam_score_int": "-25",
        "X-Spam_score": "-2.6",
        "X-Spam_bar": "--",
        "X-Spam_report": "(-2.6 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.54,\n DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1,\n RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=0.001,\n RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001,\n SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no",
        "X-Spam_action": "no action",
        "X-BeenThere": "qemu-devel@nongnu.org",
        "X-Mailman-Version": "2.1.29",
        "Precedence": "list",
        "List-Id": "qemu development <qemu-devel.nongnu.org>",
        "List-Unsubscribe": "<https://lists.nongnu.org/mailman/options/qemu-devel>,\n <mailto:qemu-devel-request@nongnu.org?subject=unsubscribe>",
        "List-Archive": "<https://lists.nongnu.org/archive/html/qemu-devel>",
        "List-Post": "<mailto:qemu-devel@nongnu.org>",
        "List-Help": "<mailto:qemu-devel-request@nongnu.org?subject=help>",
        "List-Subscribe": "<https://lists.nongnu.org/mailman/listinfo/qemu-devel>,\n <mailto:qemu-devel-request@nongnu.org?subject=subscribe>",
        "Errors-To": "qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org",
        "Sender": "qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org"
    },
    "content": "Ugly hack, gets the job done. Likely many simplifications can be made as\na result, but I didn't make any of them. There are some inconsistencies\nwith human-readable vs ENUM_NAMES in error messages in this patch, but\nit appears to work anyway.\n\nConsider this patch more of a rough idea and not anything approximating\nthe kind of code you'd want to see from an Enterprise Linux Senior\nSoftware Engineer.\n\nSigned-off-by: John Snow <jsnow@redhat.com>\n\n---\n\n[Review note: No changes to *.ir files. --js]\n\nSigned-off-by: John Snow <jsnow@redhat.com>\n---\n scripts/qapi/parser.py | 55 ++++++++++++++++++++++++++----------------\n 1 file changed, 34 insertions(+), 21 deletions(-)",
    "diff": "diff --git a/scripts/qapi/parser.py b/scripts/qapi/parser.py\nindex ade26d124df..6e91cd19e58 100644\n--- a/scripts/qapi/parser.py\n+++ b/scripts/qapi/parser.py\n@@ -547,22 +547,28 @@ def get_doc(self) -> 'QAPIDoc':\n             self.accept(False)\n             line = self.get_doc_line()\n             have_tagged = False\n-            no_more_tags = False\n+            last_ordered_section = QAPIDoc.Kind.INTRO\n \n             def _tag_check(this: Union['QAPIDoc.Kind', str]) -> None:\n+                nonlocal last_ordered_section\n                 if isinstance(this, str):\n                     this = QAPIDoc.Kind.from_string(this)\n+\n                 if this in (QAPIDoc.Kind.TODO, QAPIDoc.Kind.SINCE):\n                     return\n \n-                if no_more_tags:\n+                if this.value < last_ordered_section.value:\n                     raise QAPIParseError(\n                         self,\n-                        f\"'{this}' section cannot appear after plain \"\n-                        \"paragraphs that follow other tagged sections\\n\"\n-                        \"Move this section up above the plain paragraph(s).\"\n+                        f\"'{this}' section cannot appear after \"\n+                        f\"'{last_ordered_section}' section, please re-order \"\n+                        \"the sections and adjust phrasing as necessary to \"\n+                        \"ensure consistent documentation flow between the \"\n+                        \"source code and the rendered HTML manual\"\n                     )\n \n+                last_ordered_section = this\n+\n             while line is not None:\n                 # Blank lines\n                 while line == '':\n@@ -593,7 +599,7 @@ def _tag_check(this: Union['QAPIDoc.Kind', str]) -> None:\n                             self, 'feature descriptions expected')\n                     have_tagged = True\n                 elif line == 'Details:':\n-                    _tag_check(\"Details\")\n+                    _tag_check(QAPIDoc.Kind.DETAILS)\n                     self.accept(False)\n                     line = self.get_doc_line()\n                     while line == '':\n@@ -602,6 +608,7 @@ def _tag_check(this: Union['QAPIDoc.Kind', str]) -> None:\n                     have_tagged = True\n                 elif match := self._match_at_name_colon(line):\n                     # description\n+                    _tag_check(QAPIDoc.Kind.MEMBER)\n                     if have_tagged:\n                         raise QAPIParseError(\n                             self,\n@@ -658,14 +665,16 @@ def _tag_check(this: Union['QAPIDoc.Kind', str]) -> None:\n                     line = self.get_doc_indented(doc)\n                     have_tagged = True\n                 else:\n-                    # plain paragraph\n-                    if have_tagged:\n-                        no_more_tags = True\n-\n-                    # Paragraphs before tagged sections are \"intro\" paragraphs.\n-                    # Any appearing after are \"detail\" paragraphs.\n-                    intro = not have_tagged\n-                    doc.ensure_untagged_section(self.info, intro)\n+                    # Paragraphs appearing before any other sections are\n+                    # \"intro\" paragraphs. Any appearing after are\n+                    # \"details\" paragraphs.\n+                    this_section = (\n+                        QAPIDoc.Kind.DETAILS\n+                        if have_tagged\n+                        else QAPIDoc.Kind.INTRO\n+                    )\n+                    _tag_check(this_section)\n+                    doc.ensure_untagged_section(self.info, this_section)\n                     doc.append_line(line)\n                     line = self.get_doc_paragraph(doc)\n         else:\n@@ -707,14 +716,17 @@ class QAPIDoc:\n     \"\"\"\n \n     class Kind(enum.Enum):\n+        # The order here is the order in which sections must appear in\n+        # source code; with the exception of 'TODO' which may appear\n+        # anywhere but is treated as a comment.\n         INTRO = 0\n         MEMBER = 1\n-        FEATURE = 2\n-        RETURNS = 3\n-        ERRORS = 4\n-        SINCE = 5\n+        RETURNS = 2\n+        ERRORS = 3\n+        FEATURE = 4\n+        DETAILS = 5\n         TODO = 6\n-        DETAILS = 7\n+        SINCE = 7\n \n         @staticmethod\n         def from_string(kind: str) -> 'QAPIDoc.Kind':\n@@ -793,9 +805,10 @@ def end(self) -> None:\n     def ensure_untagged_section(\n         self,\n         info: QAPISourceInfo,\n-        intro: bool = True,\n+        kind: Optional['QAPIDoc.Kind'] = None,\n     ) -> None:\n-        kind = QAPIDoc.Kind.INTRO if intro else QAPIDoc.Kind.DETAILS\n+        if kind is None:\n+            kind = QAPIDoc.Kind.INTRO\n \n         if self.all_sections and self.all_sections[-1].kind == kind:\n             # extend current section\n",
    "prefixes": [
        "v2",
        "08/10"
    ]
}