modify the support of Ellipsis in parse for python3.8

This commit is contained in:
yepei6 2021-03-31 11:34:11 +08:00
parent 5c521492da
commit b68de64969
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)) { } else if (py::isinstance<py::none>(obj)) {
MS_LOG(INFO) << "The Constant is none:" << (std::string)py::str(obj); MS_LOG(INFO) << "The Constant is none:" << (std::string)py::str(obj);
return NewValueNode(kNone); 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 { } else {
// no else actually // no else actually
MS_EXCEPTION(TypeError) << "Unsupported Constant type : " << (std::string)py::str(obj); MS_EXCEPTION(TypeError) << "Unsupported Constant type : " << (std::string)py::str(obj);