From 706d159339fcf8d7cc414eadb5b2f0c8cb8b9032 Mon Sep 17 00:00:00 2001 From: wmayer Date: Mon, 12 Oct 2015 18:29:00 +0200 Subject: [PATCH] + fixes #0001368: Subclassing Matrix silently fails --- src/App/Application.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/App/Application.cpp b/src/App/Application.cpp index 868235fc0..06ee164ac 100644 --- a/src/App/Application.cpp +++ b/src/App/Application.cpp @@ -187,6 +187,15 @@ Application::Application(ParameterManager * /*pcSysParamMngr*/, // introducing additional classes + // 0001368: Subclassing Matrix silently fails + // Remove the Py_TPFLAGS_BASETYPE flag to disallow subclasses + Base::VectorPy::Type.tp_flags &= ~Py_TPFLAGS_BASETYPE; + Base::MatrixPy::Type.tp_flags &= ~Py_TPFLAGS_BASETYPE; + Base::BoundBoxPy::Type.tp_flags &= ~Py_TPFLAGS_BASETYPE; + Base::PlacementPy::Type.tp_flags &= ~Py_TPFLAGS_BASETYPE; + Base::RotationPy::Type.tp_flags &= ~Py_TPFLAGS_BASETYPE; + Base::AxisPy::Type.tp_flags &= ~Py_TPFLAGS_BASETYPE; + // NOTE: To finish the initialization of our own type objects we must // call PyType_Ready, otherwise we run into a segmentation fault, later on. // This function is responsible for adding inherited slots from a type's base class.