From 54f10803b4ade46db3743e8973b8dace06fcab34 Mon Sep 17 00:00:00 2001 From: Jacob Oursland Date: Wed, 16 Apr 2025 18:32:55 -0700 Subject: [PATCH] python: Make const methods declared const in C++. --- src/Tools/bindings/templates/templateClassPyExport.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/Tools/bindings/templates/templateClassPyExport.py b/src/Tools/bindings/templates/templateClassPyExport.py index 71ed0420b8..cea916559e 100644 --- a/src/Tools/bindings/templates/templateClassPyExport.py +++ b/src/Tools/bindings/templates/templateClassPyExport.py @@ -167,7 +167,7 @@ public: static int descriptorSetter(PyObject* self, PyObject* obj, PyObject* value); - static PyGetSetDef GetterSetter[]; - PyTypeObject *GetType() override {return &Type;} + PyTypeObject *GetType() const override {return &Type;} public: @self.export.Name@(@self.export.TwinPointer@ *pcObject, PyTypeObject *T = &Type); @@ -196,6 +196,9 @@ public: = elif i.Class: /// implementer for the @i.Name@() method static PyObject* @i.Name@(PyObject *self, PyObject *args, PyObject *kwd); += elif i.Const: + /// implementer for the @i.Name@() method + PyObject* @i.Name@(PyObject *args, PyObject *kwd) const; = else: /// implementer for the @i.Name@() method PyObject* @i.Name@(PyObject *args, PyObject *kwd); @@ -209,6 +212,9 @@ public: = elif i.Class: /// implementer for the @i.Name@() method static PyObject* @i.Name@(PyObject *self); += elif i.Const: + /// implementer for the @i.Name@() method + PyObject* @i.Name@() const; = else: /// implementer for the @i.Name@() method PyObject* @i.Name@(); @@ -222,6 +228,9 @@ public: = elif i.Class: /// implementer for the @i.Name@() method static PyObject* @i.Name@(PyObject *self, PyObject *args); += elif i.Const: + /// implementer for the @i.Name@() method + PyObject* @i.Name@(PyObject *args) const; = else: /// implementer for the @i.Name@() method PyObject* @i.Name@(PyObject *args);