diff options
Diffstat (limited to 'libs/python/src/object/class.cpp')
-rw-r--r-- | libs/python/src/object/class.cpp | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/libs/python/src/object/class.cpp b/libs/python/src/object/class.cpp index aeef688e28..179ec98dab 100644 --- a/libs/python/src/object/class.cpp +++ b/libs/python/src/object/class.cpp @@ -616,9 +616,11 @@ namespace objects void class_base::add_property( char const* name, object const& fget, char const* docstr) { + union { PyTypeObject *ptop; PyObject *pop; }pun = { &PyProperty_Type }; + object property( (python::detail::new_reference) - PyObject_CallFunction((PyObject*)&PyProperty_Type, const_cast<char*>("Osss"), fget.ptr(), 0, 0, docstr)); + PyObject_CallFunction(pun.pop, const_cast<char*>("Osss"), fget.ptr(), 0, 0, docstr)); this->setattr(name, property); } @@ -626,9 +628,11 @@ namespace objects void class_base::add_property( char const* name, object const& fget, object const& fset, char const* docstr) { + union { PyTypeObject *ptop; PyObject *pop; }pun = { &PyProperty_Type }; + object property( (python::detail::new_reference) - PyObject_CallFunction((PyObject*)&PyProperty_Type, const_cast<char*>("OOss"), fget.ptr(), fset.ptr(), 0, docstr)); + PyObject_CallFunction(pun.pop, const_cast<char*>("OOss"), fget.ptr(), fset.ptr(), 0, docstr)); this->setattr(name, property); } |