Skip to content

Commit 0c0d756

Browse files
committed
don't let a tuple msg be interpreted as arguments to AssertionError (closes #13268)
1 parent 78fc705 commit 0c0d756

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

Misc/NEWS

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ What's New in Python 2.7.3?
99
Core and Builtins
1010
-----------------
1111

12+
- Issue #13268: Fix the assert statement when a tuple is passed as the message.
13+
1214
- Issue #13018: Fix reference leaks in error paths in dictobject.c.
1315
Patch by Suman Saha.
1416

Python/compile.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2079,11 +2079,9 @@ compiler_assert(struct compiler *c, stmt_ty s)
20792079
ADDOP_O(c, LOAD_GLOBAL, assertion_error, names);
20802080
if (s->v.Assert.msg) {
20812081
VISIT(c, expr, s->v.Assert.msg);
2082-
ADDOP_I(c, RAISE_VARARGS, 2);
2083-
}
2084-
else {
2085-
ADDOP_I(c, RAISE_VARARGS, 1);
2082+
ADDOP_I(c, CALL_FUNCTION, 1);
20862083
}
2084+
ADDOP_I(c, RAISE_VARARGS, 1);
20872085
compiler_use_next_block(c, end);
20882086
return 1;
20892087
}

0 commit comments

Comments
 (0)