diff options
Diffstat (limited to 'Python')
-rw-r--r-- | Python/compile.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/Python/compile.c b/Python/compile.c index 43b7569..47a63e7 100644 --- a/Python/compile.c +++ b/Python/compile.c @@ -2056,6 +2056,14 @@ compiler_assert(struct compiler *c, stmt_ty s) if (assertion_error == NULL) return 0; } + if (s->v.Assert.test->kind == Tuple_kind && + asdl_seq_LEN(s->v.Assert.test->v.Tuple.elts) > 0) { + const char* msg = + "assertion is always true, perhaps remove parentheses?"; + if (PyErr_WarnExplicit(PyExc_SyntaxWarning, msg, c->c_filename, + c->u->u_lineno, NULL, NULL) == -1) + return 0; + } VISIT(c, expr, s->v.Assert.test); end = compiler_new_block(c); if (end == NULL) |