Patch Detail
Show a patch.
GET /api/patches/26184/?format=api
{ "id": 26184, "url": "https://patchwork.libcamera.org/api/patches/26184/?format=api", "web_url": "https://patchwork.libcamera.org/patch/26184/", "project": { "id": 1, "url": "https://patchwork.libcamera.org/api/projects/1/?format=api", "name": "libcamera", "link_name": "libcamera", "list_id": "libcamera_core", "list_email": "libcamera-devel@lists.libcamera.org", "web_url": "", "scm_url": "", "webscm_url": "" }, "msgid": "<20260217085309.61350-1-barnabas.pocze@ideasonboard.com>", "date": "2026-02-17T08:53:09", "name": "[v1] py: Fix include order", "commit_ref": null, "pull_url": null, "state": "superseded", "archived": false, "hash": "fabaa92e3147da0e3f41b385d8087b142549d646", "submitter": { "id": 216, "url": "https://patchwork.libcamera.org/api/people/216/?format=api", "name": "Barnabás Pőcze", "email": "barnabas.pocze@ideasonboard.com" }, "delegate": null, "mbox": "https://patchwork.libcamera.org/patch/26184/mbox/", "series": [ { "id": 5796, "url": "https://patchwork.libcamera.org/api/series/5796/?format=api", "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=5796", "date": "2026-02-17T08:53:09", "name": "[v1] py: Fix include order", "version": 1, "mbox": "https://patchwork.libcamera.org/series/5796/mbox/" } ], "comments": "https://patchwork.libcamera.org/api/patches/26184/comments/", "check": "pending", "checks": "https://patchwork.libcamera.org/api/patches/26184/checks/", "tags": {}, "headers": { "Return-Path": "<libcamera-devel-bounces@lists.libcamera.org>", "X-Original-To": "parsemail@patchwork.libcamera.org", "Delivered-To": "parsemail@patchwork.libcamera.org", "Received": [ "from lancelot.ideasonboard.com (lancelot.ideasonboard.com\n\t[92.243.16.209])\n\tby patchwork.libcamera.org (Postfix) with ESMTPS id 561CEC31E9\n\tfor <parsemail@patchwork.libcamera.org>;\n\tTue, 17 Feb 2026 08:53:14 +0000 (UTC)", "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 7BC656220A;\n\tTue, 17 Feb 2026 09:53:13 +0100 (CET)", "from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 931D7621F6\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 17 Feb 2026 09:53:12 +0100 (CET)", "from pb-laptop.local (185.221.141.206.nat.pool.zt.hu\n\t[185.221.141.206])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 065F7161\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 17 Feb 2026 09:52:20 +0100 (CET)" ], "Authentication-Results": "lancelot.ideasonboard.com; dkim=pass (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"aYexlt3e\"; dkim-atps=neutral", "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1771318341;\n\tbh=qaYqR4fDGpxme2ZaukfcyVGMFHWnBnnC8N4B5T4RhCY=;\n\th=From:To:Subject:Date:From;\n\tb=aYexlt3eIEXJVJCIiMq6eOtCSoFTNF7Njw4rBM3g81kYVx60UoBHNcik1z6I4tEvK\n\t7tsebnHyOZWS+ocDCPexq9bs4j816PAsR1feGIpVg6pNRPADDFrr2IydJShGESWjj/\n\tfaNQrPj1htTZUmOqaTEiIfs9lRwBWrrokIzE0n8E=", "From": "=?utf-8?q?Barnab=C3=A1s_P=C5=91cze?= <barnabas.pocze@ideasonboard.com>", "To": "libcamera-devel@lists.libcamera.org", "Subject": "[PATCH v1] py: Fix include order", "Date": "Tue, 17 Feb 2026 09:53:09 +0100", "Message-ID": "<20260217085309.61350-1-barnabas.pocze@ideasonboard.com>", "X-Mailer": "git-send-email 2.53.0", "MIME-Version": "1.0", "Content-Type": "text/plain; charset=UTF-8", "Content-Transfer-Encoding": "8bit", "X-BeenThere": "libcamera-devel@lists.libcamera.org", "X-Mailman-Version": "2.1.29", "Precedence": "list", "List-Id": "<libcamera-devel.lists.libcamera.org>", "List-Unsubscribe": "<https://lists.libcamera.org/options/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=unsubscribe>", "List-Archive": "<https://lists.libcamera.org/pipermail/libcamera-devel/>", "List-Post": "<mailto:libcamera-devel@lists.libcamera.org>", "List-Help": "<mailto:libcamera-devel-request@lists.libcamera.org?subject=help>", "List-Subscribe": "<https://lists.libcamera.org/listinfo/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=subscribe>", "Errors-To": "libcamera-devel-bounces@lists.libcamera.org", "Sender": "\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>" }, "content": "Python.h hence the pybind headers must be included first since pyconfig.h\nunconditionally overrides certain feature test macros[0]. This was mostly\nhidden by the fact that macro redefinitions with the same value do not\ntrigger compiler warnings. However, glibc 43 has changed certain defaults[1],\ncausing mismatches, leading to compiler warnings.\n\nSo change the include order so that `<pybind11/...>` headers are included\nfirst and then the local `\"py_...\"` headers, and then everything else.\n\nAlso adjust `.clang-format` as well.\n\n[0]: https://docs.python.org/3/c-api/intro.html#include-files\n[1]: https://sourceware.org/git/?p=glibc.git;a=commit;h=a5cc3018f31a125f019685b239c6e5a0bf1a272b\n\nLink: https://github.com/python/cpython/issues/61322\nSigned-off-by: Barnabás Pőcze <barnabas.pocze@ideasonboard.com>\n---\n .clang-format | 6 ++++++\n src/py/libcamera/py_camera_manager.cpp | 3 +--\n src/py/libcamera/py_camera_manager.h | 4 ++--\n src/py/libcamera/py_color_space.cpp | 6 +++---\n src/py/libcamera/py_controls_generated.cpp.in | 4 ++--\n src/py/libcamera/py_enums.cpp | 4 ++--\n src/py/libcamera/py_formats_generated.cpp.in | 4 ++--\n src/py/libcamera/py_geometry.cpp | 10 +++++-----\n src/py/libcamera/py_helpers.cpp | 8 ++++----\n src/py/libcamera/py_helpers.h | 4 ++--\n src/py/libcamera/py_main.cpp | 15 +++++++--------\n src/py/libcamera/py_main.h | 4 ++--\n src/py/libcamera/py_transform.cpp | 6 +++---\n 13 files changed, 41 insertions(+), 37 deletions(-)", "diff": "diff --git a/.clang-format b/.clang-format\nindex 7fc30f614..7dbeea784 100644\n--- a/.clang-format\n+++ b/.clang-format\n@@ -77,6 +77,12 @@ IncludeCategories:\n - Regex: '<Q([A-Za-z0-9\\-_])+>'\n CaseSensitive: true\n Priority: 9\n+ # Python.h hence pybind11 headers must be included first\n+ # https://docs.python.org/3/c-api/intro.html#include-files\n+ - Regex: '<pybind11/.*>'\n+ Priority: -9\n+ - Regex: '\"py_.*\"'\n+ Priority: -8\n # Headers in <> with an extension. (+system libraries)\n - Regex: '<([A-Za-z0-9\\-_])+\\.h>'\n Priority: 2\ndiff --git a/src/py/libcamera/py_camera_manager.cpp b/src/py/libcamera/py_camera_manager.cpp\nindex 9ccb7aada..3159bce5b 100644\n--- a/src/py/libcamera/py_camera_manager.cpp\n+++ b/src/py/libcamera/py_camera_manager.cpp\n@@ -4,6 +4,7 @@\n */\n \n #include \"py_camera_manager.h\"\n+#include \"py_main.h\"\n \n #include <errno.h>\n #include <memory>\n@@ -12,8 +13,6 @@\n #include <unistd.h>\n #include <vector>\n \n-#include \"py_main.h\"\n-\n namespace py = pybind11;\n \n using namespace libcamera;\ndiff --git a/src/py/libcamera/py_camera_manager.h b/src/py/libcamera/py_camera_manager.h\nindex af69b915e..7da65172e 100644\n--- a/src/py/libcamera/py_camera_manager.h\n+++ b/src/py/libcamera/py_camera_manager.h\n@@ -5,12 +5,12 @@\n \n #pragma once\n \n+#include <pybind11/pybind11.h>\n+\n #include <libcamera/base/mutex.h>\n \n #include <libcamera/libcamera.h>\n \n-#include <pybind11/pybind11.h>\n-\n using namespace libcamera;\n \n class PyCameraManager\ndiff --git a/src/py/libcamera/py_color_space.cpp b/src/py/libcamera/py_color_space.cpp\nindex fd5a5dabe..2f4d2d891 100644\n--- a/src/py/libcamera/py_color_space.cpp\n+++ b/src/py/libcamera/py_color_space.cpp\n@@ -5,15 +5,15 @@\n * Python bindings - Color Space classes\n */\n \n-#include <libcamera/color_space.h>\n-#include <libcamera/libcamera.h>\n-\n #include <pybind11/operators.h>\n #include <pybind11/pybind11.h>\n #include <pybind11/stl.h>\n \n #include \"py_main.h\"\n \n+#include <libcamera/color_space.h>\n+#include <libcamera/libcamera.h>\n+\n namespace py = pybind11;\n \n using namespace libcamera;\ndiff --git a/src/py/libcamera/py_controls_generated.cpp.in b/src/py/libcamera/py_controls_generated.cpp.in\nindex 22a132d19..c42a477bb 100644\n--- a/src/py/libcamera/py_controls_generated.cpp.in\n+++ b/src/py/libcamera/py_controls_generated.cpp.in\n@@ -7,12 +7,12 @@\n * This file is auto-generated. Do not edit.\n */\n \n-#include <libcamera/{{header}}>\n-\n #include <pybind11/pybind11.h>\n \n #include \"py_main.h\"\n \n+#include <libcamera/{{header}}>\n+\n namespace py = pybind11;\n \n class Py{{mode|capitalize}}\ndiff --git a/src/py/libcamera/py_enums.cpp b/src/py/libcamera/py_enums.cpp\nindex 9e75ec1a9..715b63880 100644\n--- a/src/py/libcamera/py_enums.cpp\n+++ b/src/py/libcamera/py_enums.cpp\n@@ -5,12 +5,12 @@\n * Python bindings - Enumerations\n */\n \n-#include <libcamera/libcamera.h>\n-\n #include <pybind11/pybind11.h>\n \n #include \"py_main.h\"\n \n+#include <libcamera/libcamera.h>\n+\n namespace py = pybind11;\n \n using namespace libcamera;\ndiff --git a/src/py/libcamera/py_formats_generated.cpp.in b/src/py/libcamera/py_formats_generated.cpp.in\nindex c5fb90639..9da3a3c79 100644\n--- a/src/py/libcamera/py_formats_generated.cpp.in\n+++ b/src/py/libcamera/py_formats_generated.cpp.in\n@@ -7,12 +7,12 @@\n * This file is auto-generated. Do not edit.\n */\n \n-#include <libcamera/formats.h>\n-\n #include <pybind11/pybind11.h>\n \n #include \"py_main.h\"\n \n+#include <libcamera/formats.h>\n+\n namespace py = pybind11;\n \n class PyFormats\ndiff --git a/src/py/libcamera/py_geometry.cpp b/src/py/libcamera/py_geometry.cpp\nindex c7e303609..d96015f03 100644\n--- a/src/py/libcamera/py_geometry.cpp\n+++ b/src/py/libcamera/py_geometry.cpp\n@@ -5,17 +5,17 @@\n * Python bindings - Geometry classes\n */\n \n-#include <array>\n-\n-#include <libcamera/geometry.h>\n-#include <libcamera/libcamera.h>\n-\n #include <pybind11/operators.h>\n #include <pybind11/pybind11.h>\n #include <pybind11/stl.h>\n \n #include \"py_main.h\"\n \n+#include <array>\n+\n+#include <libcamera/geometry.h>\n+#include <libcamera/libcamera.h>\n+\n namespace py = pybind11;\n \n using namespace libcamera;\ndiff --git a/src/py/libcamera/py_helpers.cpp b/src/py/libcamera/py_helpers.cpp\nindex 8c55ef845..b9142225c 100644\n--- a/src/py/libcamera/py_helpers.cpp\n+++ b/src/py/libcamera/py_helpers.cpp\n@@ -3,14 +3,14 @@\n * Copyright (C) 2022, Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>\n */\n \n-#include \"py_helpers.h\"\n-\n-#include <libcamera/libcamera.h>\n-\n #include <pybind11/functional.h>\n #include <pybind11/stl.h>\n #include <pybind11/stl_bind.h>\n \n+#include \"py_helpers.h\"\n+\n+#include <libcamera/libcamera.h>\n+\n namespace py = pybind11;\n \n using namespace libcamera;\ndiff --git a/src/py/libcamera/py_helpers.h b/src/py/libcamera/py_helpers.h\nindex 983969dff..989fae77b 100644\n--- a/src/py/libcamera/py_helpers.h\n+++ b/src/py/libcamera/py_helpers.h\n@@ -5,9 +5,9 @@\n \n #pragma once\n \n-#include <libcamera/libcamera.h>\n-\n #include <pybind11/pybind11.h>\n \n+#include <libcamera/libcamera.h>\n+\n pybind11::object controlValueToPy(const libcamera::ControlValue &cv);\n libcamera::ControlValue pyToControlValue(const pybind11::object &ob, libcamera::ControlType type);\ndiff --git a/src/py/libcamera/py_main.cpp b/src/py/libcamera/py_main.cpp\nindex a983ea75c..d0ef6915b 100644\n--- a/src/py/libcamera/py_main.cpp\n+++ b/src/py/libcamera/py_main.cpp\n@@ -5,6 +5,13 @@\n * Python bindings\n */\n \n+#include <pybind11/functional.h>\n+#include <pybind11/pybind11.h>\n+#include <pybind11/stl.h>\n+#include <pybind11/stl_bind.h>\n+\n+#include \"py_camera_manager.h\"\n+#include \"py_helpers.h\"\n #include \"py_main.h\"\n \n #include <limits>\n@@ -17,14 +24,6 @@\n \n #include <libcamera/libcamera.h>\n \n-#include <pybind11/functional.h>\n-#include <pybind11/pybind11.h>\n-#include <pybind11/stl.h>\n-#include <pybind11/stl_bind.h>\n-\n-#include \"py_camera_manager.h\"\n-#include \"py_helpers.h\"\n-\n namespace py = pybind11;\n \n using namespace libcamera;\ndiff --git a/src/py/libcamera/py_main.h b/src/py/libcamera/py_main.h\nindex 4d594326e..dd31c6d9a 100644\n--- a/src/py/libcamera/py_main.h\n+++ b/src/py/libcamera/py_main.h\n@@ -5,10 +5,10 @@\n \n #pragma once\n \n-#include <libcamera/base/log.h>\n-\n #include <pybind11/pybind11.h>\n \n+#include <libcamera/base/log.h>\n+\n namespace libcamera {\n \n LOG_DECLARE_CATEGORY(Python)\ndiff --git a/src/py/libcamera/py_transform.cpp b/src/py/libcamera/py_transform.cpp\nindex 768260ffc..8719b5ff5 100644\n--- a/src/py/libcamera/py_transform.cpp\n+++ b/src/py/libcamera/py_transform.cpp\n@@ -5,15 +5,15 @@\n * Python bindings - Transform class\n */\n \n-#include <libcamera/transform.h>\n-#include <libcamera/libcamera.h>\n-\n #include <pybind11/operators.h>\n #include <pybind11/pybind11.h>\n #include <pybind11/stl.h>\n \n #include \"py_main.h\"\n \n+#include <libcamera/transform.h>\n+#include <libcamera/libcamera.h>\n+\n namespace py = pybind11;\n \n using namespace libcamera;\n", "prefixes": [ "v1" ] }