Expression: fix python object evaluation

This commit is contained in:
Zheng, Lei
2019-07-17 13:09:21 +08:00
committed by wmayer
parent 9b3351399b
commit e0799e2bb3
2 changed files with 8 additions and 0 deletions

View File

@@ -2350,6 +2350,13 @@ Expression* PyObjectExpression::_copy() const
return new PyObjectExpression(owner,pyObj,false);
}
boost::any PyObjectExpression::getValueAsAny() const {
if(!pyObj || pyObj == Py_None)
return boost::any();
Base::PyGILStateLocker lock;
return App::any(pyObjectWrap(pyObj));
}
//
// StringExpression class
//

View File

@@ -529,6 +529,7 @@ public:
void setPyObject(PyObject *pyobj, bool owned=false);
virtual std::string toString(bool) const;
virtual boost::any getValueAsAny() const;
virtual Expression * eval() const { return copy(); }
virtual Expression * simplify() const { return copy(); }