summaryrefslogtreecommitdiff
path: root/libs/python/src/object/class.cpp
diff options
context:
space:
mode:
authorAnas Nashif <anas.nashif@intel.com>2012-10-30 13:04:54 -0700
committerChanho Park <chanho61.park@samsung.com>2014-12-11 19:00:15 +0900
commit11de24e3b46636390e81d680827bb541634d5d6a (patch)
treed745bc0201f5e67ac19a3c202a38d5a9424fa1fe /libs/python/src/object/class.cpp
parent4b7d643389d1458ea53c7c08b17650a3889880f2 (diff)
downloadboost-11de24e3b46636390e81d680827bb541634d5d6a.tar.gz
boost-11de24e3b46636390e81d680827bb541634d5d6a.tar.bz2
boost-11de24e3b46636390e81d680827bb541634d5d6a.zip
no type punning
Diffstat (limited to 'libs/python/src/object/class.cpp')
-rw-r--r--libs/python/src/object/class.cpp8
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);
}