summaryrefslogtreecommitdiffstats
path: root/Python/ast.c
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2016-06-27 18:39:12 (GMT)
committerSerhiy Storchaka <storchaka@gmail.com>2016-06-27 18:39:12 (GMT)
commitfbd1523525ed385555357fab546f78e318f03f4b (patch)
treec8d91d0abc1c658a14c005b1b7ea668dc7a90751 /Python/ast.c
parent44a98b6bf3f110c900979894ccb89753088c3aaa (diff)
downloadcpython-fbd1523525ed385555357fab546f78e318f03f4b.zip
cpython-fbd1523525ed385555357fab546f78e318f03f4b.tar.gz
cpython-fbd1523525ed385555357fab546f78e318f03f4b.tar.bz2
Issue #27352: Correct the validation of the ImportFrom AST node and simplify
the implementation of the IMPORT_NAME opcode.
Diffstat (limited to 'Python/ast.c')
-rw-r--r--Python/ast.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/Python/ast.c b/Python/ast.c
index 1efd0b7..8c13e0b 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");