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
717a9582
Commit
717a9582
authored
May 10, 2015
by
Paul Sokolovsky
Browse files
unix: Print unhandled exception to stderr, like CPython does.
parent
4ed7b7f7
Changes
1
Hide whitespace changes
Inline
Side-by-side
unix/main.c
View file @
717a9582
...
@@ -73,6 +73,13 @@ STATIC void sighandler(int signum) {
...
@@ -73,6 +73,13 @@ STATIC void sighandler(int signum) {
}
}
#endif
#endif
STATIC
void
stderr_print_strn
(
void
*
env
,
const
char
*
str
,
mp_uint_t
len
)
{
(
void
)
env
;
fwrite
(
str
,
len
,
1
,
stderr
);
}
const
mp_print_t
mp_stderr_print
=
{
NULL
,
stderr_print_strn
};
#define FORCED_EXIT (0x100)
#define FORCED_EXIT (0x100)
// If exc is SystemExit, return value where FORCED_EXIT bit set,
// If exc is SystemExit, return value where FORCED_EXIT bit set,
// and lower 8 bits are SystemExit value. For all other exceptions,
// and lower 8 bits are SystemExit value. For all other exceptions,
...
@@ -90,7 +97,7 @@ STATIC int handle_uncaught_exception(mp_obj_t exc) {
...
@@ -90,7 +97,7 @@ STATIC int handle_uncaught_exception(mp_obj_t exc) {
}
}
// Report all other exceptions
// Report all other exceptions
mp_obj_print_exception
(
&
mp_
plat
_print
,
exc
);
mp_obj_print_exception
(
&
mp_
stderr
_print
,
exc
);
return
1
;
return
1
;
}
}
...
...
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