diff options
Diffstat (limited to 'libs/python/src/str.cpp')
-rw-r--r-- | libs/python/src/str.cpp | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/libs/python/src/str.cpp b/libs/python/src/str.cpp index 0bc225aa22..1b7e59cd9b 100644 --- a/libs/python/src/str.cpp +++ b/libs/python/src/str.cpp @@ -9,14 +9,14 @@ namespace boost { namespace python { namespace detail { detail::new_reference str_base::call(object const& arg_) { - return (detail::new_reference)PyObject_CallFunction( #if PY_VERSION_HEX >= 0x03000000 - (PyObject*)&PyUnicode_Type, + union { PyTypeObject *ptop; PyObject *pop; }pun = { &PyUnicode_Type }; #else - (PyObject*)&PyString_Type, + union { PyTypeObject *ptop; PyObject *pop; }pun = { &PyString_Type }; #endif - const_cast<char*>("(O)"), - arg_.ptr()); + + return (detail::new_reference)PyObject_CallFunction( + pun.pop, const_cast<char*>("(O)"), arg_.ptr()); } str_base::str_base() |