!14489 modify the parse module to adapt to python3.8 ast

From: @yepei6
Reviewed-by: @zh_qh,@kingxian
Signed-off-by: @zh_qh
This commit is contained in:
mindspore-ci-bot 2021-03-31 21:04:09 +08:00 committed by Gitee
commit c1eb3f30a5
1 changed files with 3 additions and 0 deletions

View File

@ -581,6 +581,9 @@ AnfNodePtr Parser::ParseConstant(const FunctionBlockPtr &, const py::object &nod
} else if (py::isinstance<py::none>(obj)) {
MS_LOG(INFO) << "The Constant is none:" << (std::string)py::str(obj);
return NewValueNode(kNone);
} else if (py::isinstance<py::ellipsis>(obj)) {
MS_LOG(INFO) << "The Constance is ellipsis:" << (std::string)py::str(obj);
return NewValueNode(kEllipsis);
} else {
// no else actually
MS_EXCEPTION(TypeError) << "Unsupported Constant type : " << (std::string)py::str(obj);