py3: App: files D-Z ported to python3
issue 0000995 diff to py3-branch will remain in the following files in src/App: - ExtensionContainer.cpp - FeaturePythonPyImp.h +.inl most likely these files depend on Tools and Base
This commit is contained in:
@@ -1035,18 +1035,28 @@ boost::any ObjectIdentifier::getValue() const
|
||||
|
||||
if (!pyvalue)
|
||||
throw Base::RuntimeError("Failed to get property value.");
|
||||
|
||||
#if PY_MAJOR_VERSION < 3
|
||||
if (PyInt_Check(pyvalue))
|
||||
return boost::any(PyInt_AsLong(pyvalue));
|
||||
#else
|
||||
if (PyLong_Check(pyvalue))
|
||||
return boost::any(PyLong_AsLong(pyvalue));
|
||||
#endif
|
||||
else if (PyFloat_Check(pyvalue))
|
||||
return boost::any(PyFloat_AsDouble(pyvalue));
|
||||
#if PY_MAJOR_VERSION < 3
|
||||
else if (PyString_Check(pyvalue))
|
||||
return boost::any(PyString_AsString(pyvalue));
|
||||
#endif
|
||||
else if (PyUnicode_Check(pyvalue)) {
|
||||
PyObject * s = PyUnicode_AsUTF8String(pyvalue);
|
||||
destructor d2(s);
|
||||
|
||||
#if PY_MAJOR_VERSION >= 3
|
||||
return boost::any(PyUnicode_AsUTF8(s));
|
||||
#else
|
||||
return boost::any(PyString_AsString(s));
|
||||
#endif
|
||||
}
|
||||
else if (PyObject_TypeCheck(pyvalue, &Base::QuantityPy::Type)) {
|
||||
Base::QuantityPy * qp = static_cast<Base::QuantityPy*>(pyvalue);
|
||||
|
||||
Reference in New Issue
Block a user