From 07261b161d83f8021c6dbea0bcd78e40bf7c3c61 Mon Sep 17 00:00:00 2001 From: wmayer Date: Tue, 25 Jul 2017 01:07:09 +0200 Subject: [PATCH] fix Py3 issue --- src/Base/QuantityPyImp.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/Base/QuantityPyImp.cpp b/src/Base/QuantityPyImp.cpp index 3f28b3c7cf..dd4c1c2440 100644 --- a/src/Base/QuantityPyImp.cpp +++ b/src/Base/QuantityPyImp.cpp @@ -624,7 +624,11 @@ void QuantityPy::setFormat(Py::Tuple arg) Py::Char form(arg.getItem(1)); fmt.precision = static_cast(prec); +#if PY_MAJOR_VERSION >= 3 + std::string fmtstr = static_cast(Py::String(form)); +#else std::string fmtstr = static_cast(form); +#endif if (fmtstr.size() != 1) throw Py::ValueError("Invalid format character"); switch (fmtstr.front()) {