summaryrefslogtreecommitdiff
path: root/ports/unix
diff options
context:
space:
mode:
authorDavid Lechner <david@lechnology.com>2017-09-24 20:15:48 -0500
committerDamien George <damien.p.george@gmail.com>2017-09-26 11:59:11 +1000
commit62849b7010abffb7b0a9c9875930efe7cb77519c (patch)
treedf719db4ca96bffd7bad42f0823feaf9cc30f81a /ports/unix
parent9d836fedbdb1d28bdfc4ba475bbdfc1adb3f007a (diff)
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.
Diffstat (limited to 'ports/unix')
-rw-r--r--ports/unix/mpconfigport.h3
1 files changed, 3 insertions, 0 deletions
diff --git a/ports/unix/mpconfigport.h b/ports/unix/mpconfigport.h
index b557f3d44..50b979279 100644
--- a/ports/unix/mpconfigport.h
+++ b/ports/unix/mpconfigport.h
@@ -145,8 +145,11 @@
// names in exception messages (may require more RAM).
#define MICROPY_ERROR_REPORTING (MICROPY_ERROR_REPORTING_DETAILED)
#define MICROPY_WARNINGS (1)
+#define MICROPY_ERROR_PRINTER (&mp_stderr_print)
#define MICROPY_PY_STR_BYTES_CMP_WARN (1)
+extern const struct _mp_print_t mp_stderr_print;
+
// Define to 1 to use undertested inefficient GC helper implementation
// (if more efficient arch-specific one is not available).
#ifndef MICROPY_GCREGS_SETJMP