]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
don't let a tuple msg be interpreted as arguments to AssertionError (closes #13268)
authorBenjamin Peterson <benjamin@python.org>
Thu, 27 Oct 2011 12:21:59 +0000 (08:21 -0400)
committerBenjamin Peterson <benjamin@python.org>
Thu, 27 Oct 2011 12:21:59 +0000 (08:21 -0400)
Misc/NEWS
Python/compile.c

index 04aa011cecb8a0b290087fa358cc757a96c09a69..9f7028fef5bf18dfff2d4f64b66034402163ddab 100644 (file)
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -9,6 +9,8 @@ What's New in Python 2.7.3?
 Core and Builtins
 -----------------
 
+- Issue #13268: Fix the assert statement when a tuple is passed as the message.
+
 - Issue #13018: Fix reference leaks in error paths in dictobject.c.
   Patch by Suman Saha.
 
index 9440cec0bad0a518ab437ec85adeda066415cae9..119c60f9b23b4dd01c12a846d933e22bf5ed8275 100644 (file)
@@ -2079,11 +2079,9 @@ compiler_assert(struct compiler *c, stmt_ty s)
     ADDOP_O(c, LOAD_GLOBAL, assertion_error, names);
     if (s->v.Assert.msg) {
         VISIT(c, expr, s->v.Assert.msg);
-        ADDOP_I(c, RAISE_VARARGS, 2);
-    }
-    else {
-        ADDOP_I(c, RAISE_VARARGS, 1);
+        ADDOP_I(c, CALL_FUNCTION, 1);
     }
+    ADDOP_I(c, RAISE_VARARGS, 1);
     compiler_use_next_block(c, end);
     return 1;
 }