From fbd1523525ed385555357fab546f78e318f03f4b Mon Sep 17 00:00:00 2001 From: Serhiy Storchaka Date: Mon, 27 Jun 2016 21:39:12 +0300 Subject: Issue #27352: Correct the validation of the ImportFrom AST node and simplify the implementation of the IMPORT_NAME opcode. --- Python/ast.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'Python/ast.c') diff --git a/Python/ast.c b/Python/ast.c index 1efd0b7daa..8c13e0b29c 100644 --- a/Python/ast.c +++ b/Python/ast.c @@ -475,8 +475,8 @@ validate_stmt(stmt_ty stmt) case Import_kind: return validate_nonempty_seq(stmt->v.Import.names, "names", "Import"); case ImportFrom_kind: - if (stmt->v.ImportFrom.level < -1) { - PyErr_SetString(PyExc_ValueError, "ImportFrom level less than -1"); + if (stmt->v.ImportFrom.level < 0) { + PyErr_SetString(PyExc_ValueError, "Negative ImportFrom level"); return 0; } return validate_nonempty_seq(stmt->v.ImportFrom.names, "names", "ImportFrom"); -- cgit v1.2.1