From 0e4ba258349ae94a18fb4e56dee7e1d4cc1ba3f0 Mon Sep 17 00:00:00 2001 From: Damien George Date: Sun, 13 Apr 2014 15:01:28 +0100 Subject: py: Fix SyntaxError exception: don't have a block name, so pass NULL. --- py/obj.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'py/obj.c') diff --git a/py/obj.c b/py/obj.c index bdafc7247..078284f2a 100644 --- a/py/obj.c +++ b/py/obj.c @@ -55,10 +55,17 @@ void mp_obj_print_exception(mp_obj_t exc) { printf("Traceback (most recent call last):\n"); for (int i = n - 3; i >= 0; i -= 3) { #if MICROPY_ENABLE_SOURCE_LINE - printf(" File \"%s\", line %d, in %s\n", qstr_str(values[i]), (int)values[i + 1], qstr_str(values[i + 2])); + printf(" File \"%s\", line %d", qstr_str(values[i]), (int)values[i + 1]); #else - printf(" File \"%s\", in %s\n", qstr_str(values[i]), qstr_str(values[i + 2])); + printf(" File \"%s\"", qstr_str(values[i])); #endif + // the block name can be NULL if it's unknown + qstr block = values[i + 2]; + if (block == MP_QSTR_NULL) { + printf("\n"); + } else { + printf(", in %s\n", qstr_str(block)); + } } } } -- cgit v1.2.3