Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
TASTE
uPython-mirror
Commits
3be6984b
Commit
3be6984b
authored
Oct 22, 2014
by
Damien George
Browse files
stmhal: Don't return SystemExit value from parse_compile_execute.
There is no need, since we don't (currently) use the value.
parent
8d62bbd4
Changes
2
Hide whitespace changes
Inline
Side-by-side
stmhal/pyexec.c
View file @
3be6984b
...
...
@@ -91,18 +91,13 @@ int parse_compile_execute(mp_lexer_t *lex, mp_parse_input_kind_t input_kind, boo
// FIXME it could be that an interrupt happens just before we disable it here
usb_vcp_set_interrupt_char
(
VCP_CHAR_NONE
);
// disable interrupt
// check for SystemExit
mp_obj_t
exc
=
(
mp_obj_t
)
nlr
.
ret_val
;
if
(
mp_obj_is_subclass_fast
(
mp_obj_get_type
(
exc
),
&
mp_type_SystemExit
))
{
// None is an exit value of 0; an int is its value; anything else is 1
mp_obj_t
exit_val
=
mp_obj_exception_get_value
(
exc
);
mp_int_t
val
=
0
;
if
(
exit_val
!=
mp_const_none
&&
!
mp_obj_get_int_maybe
(
exit_val
,
&
val
))
{
val
=
1
;
}
return
PYEXEC_FORCED_EXIT
|
(
val
&
255
);
if
(
mp_obj_is_subclass_fast
(
mp_obj_get_type
((
mp_obj_t
)
nlr
.
ret_val
),
&
mp_type_SystemExit
))
{
// at the moment, the value of SystemExit is unused
ret
=
PYEXEC_FORCED_EXIT
;
}
else
{
mp_obj_print_exception
((
mp_obj_t
)
nlr
.
ret_val
);
ret
=
0
;
}
mp_obj_print_exception
((
mp_obj_t
)
nlr
.
ret_val
);
ret
=
0
;
}
// display debugging info if wanted
...
...
@@ -269,7 +264,7 @@ friendly_repl_reset:
}
}
bool
pyexec_file
(
const
char
*
filename
)
{
int
pyexec_file
(
const
char
*
filename
)
{
mp_lexer_t
*
lex
=
mp_lexer_new_from_file
(
filename
);
if
(
lex
==
NULL
)
{
...
...
stmhal/pyexec.h
View file @
3be6984b
...
...
@@ -35,6 +35,6 @@ extern pyexec_mode_kind_t pyexec_mode_kind;
int
pyexec_raw_repl
(
void
);
int
pyexec_friendly_repl
(
void
);
bool
pyexec_file
(
const
char
*
filename
);
int
pyexec_file
(
const
char
*
filename
);
MP_DECLARE_CONST_FUN_OBJ
(
pyb_set_repl_info_obj
);
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a 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