Skip to content

Commit

Permalink
Expression: fix python object evaluation
Browse files Browse the repository at this point in the history
  • Loading branch information
realthunder authored and wwmayer committed Aug 17, 2019
1 parent 9b33513 commit e0799e2
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/App/Expression.cpp
Expand Up @@ -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
//
Expand Down
1 change: 1 addition & 0 deletions src/App/Expression.h
Expand Up @@ -529,6 +529,7 @@ class AppExport PyObjectExpression : public Expression {
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(); }
Expand Down

0 comments on commit e0799e2

Please sign in to comment.