Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Script] Be more careful when generating ast.ExtSlice for Subscript (#…
…15483) * [Script] Be more careful when generating ast.ExtSlice for Subscript The ast.ExtSlice expects a non-empty list, otherwise evaluation fails with "error: empty dims on ExtSlice". Also, each element in "dims" list of ExtSlice must be either Slice or Index. In python3.8 an expression A[()] is parsed (by ast) as Subscript with slice being Index(value=Tuple(elts=[])). When we translate a subscript from doc.AST to ast, we unconditionally convert every tuple to ast.ExtSlice, which in this case is incorrect. The fix is to map empty tuple back to the Index(Tuple[])) instead of ExtSlice. In other cases, ensure that members of ExtSlice are of correct types. * Fix lint #1
- Loading branch information