]> granicus.if.org Git - python/commitdiff
Fix ast_for_atom()
authorVictor Stinner <victor.stinner@gmail.com>
Thu, 3 Sep 2015 10:57:11 +0000 (12:57 +0200)
committerVictor Stinner <victor.stinner@gmail.com>
Thu, 3 Sep 2015 10:57:11 +0000 (12:57 +0200)
Clear PyObject_Str() exception if it failed, ast_error() should not be called
with an exception set.

Python/ast.c

index c1ce0aa9aaa8d85ba4ed96b482e074a1cb248bea..1f7ddfc1978caf32735c0e6865751571d74acc0f 100644 (file)
@@ -2040,6 +2040,7 @@ ast_for_atom(struct compiling *c, const node *n)
                     PyOS_snprintf(buf, sizeof(buf), "(%s) %s", errtype, s);
                     Py_DECREF(errstr);
                 } else {
+                    PyErr_Clear();
                     PyOS_snprintf(buf, sizeof(buf), "(%s) unknown error", errtype);
                 }
                 ast_error(c, n, buf);