py: Add config option to print warnings/errors to stderr.
This adds a new configuration option to print runtime warnings and errors to stderr. On Unix, CPython prints warnings and unhandled exceptions to stderr, so the unix port here is configured to use this option. The unix port already printed unhandled exceptions on the main thread to stderr. This patch fixes unhandled exceptions on other threads and warnings (issue #2838) not printing on stderr. Additionally, a couple tests needed to be fixed to handle this new behavior. This is done by also capturing stderr when running tests.
This commit is contained in:
committed by
Damien George
parent
9d836fedbd
commit
62849b7010
@@ -35,9 +35,9 @@
|
||||
void mp_warning(const char *msg, ...) {
|
||||
va_list args;
|
||||
va_start(args, msg);
|
||||
mp_print_str(&mp_plat_print, "Warning: ");
|
||||
mp_vprintf(&mp_plat_print, msg, args);
|
||||
mp_print_str(&mp_plat_print, "\n");
|
||||
mp_print_str(MICROPY_ERROR_PRINTER, "Warning: ");
|
||||
mp_vprintf(MICROPY_ERROR_PRINTER, msg, args);
|
||||
mp_print_str(MICROPY_ERROR_PRINTER, "\n");
|
||||
va_end(args);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user