Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
TASTE
uPython-mirror
Commits
0e4ba258
Commit
0e4ba258
authored
Apr 13, 2014
by
Damien George
Browse files
py: Fix SyntaxError exception: don't have a block name, so pass NULL.
parent
73496fbb
Changes
2
Hide whitespace changes
Inline
Side-by-side
py/obj.c
View file @
0e4ba258
...
...
@@ -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
));
}
}
}
}
...
...
py/parsehelper.c
View file @
0e4ba258
...
...
@@ -61,7 +61,8 @@ mp_obj_t mp_parse_make_exception(mp_lexer_t *lex, mp_parse_error_kind_t parse_er
}
// add traceback to give info about file name and location
mp_obj_exception_add_traceback
(
exc
,
mp_lexer_source_name
(
lex
),
mp_lexer_cur
(
lex
)
->
src_line
,
mp_lexer_cur
(
lex
)
->
src_column
);
// we don't have a 'block' name, so just pass the NULL qstr to indicate this
mp_obj_exception_add_traceback
(
exc
,
mp_lexer_source_name
(
lex
),
mp_lexer_cur
(
lex
)
->
src_line
,
MP_QSTR_NULL
);
return
exc
;
}
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment