diff options
author | Matthias Urlichs <matthias@urlichs.de> | 2023-10-06 21:03:24 +0200 |
---|---|---|
committer | Damien George <damien@micropython.org> | 2023-10-13 14:55:54 +1100 |
commit | 5f0bd33b732151bb7aa896307afae55400b15454 (patch) | |
tree | 66d7ac610dc07ab092e369f0148742cae1a1ebed /extmod/asyncio/core.py | |
parent | 05cb1406ad1b421a238faf763e19f4119f5f6bb2 (diff) | |
download | micropython-5f0bd33b732151bb7aa896307afae55400b15454.tar.gz micropython-5f0bd33b732151bb7aa896307afae55400b15454.zip |
extmod/asyncio: Emit errors to stderr, not stdout.
Sometimes these are different file descriptors, not to mention the Unix
port, so use stderr to distinguish these error messages.
CPython prints to stdout, but it does it via a call to the logging module.
We don't want to introduce a dependency on logging, so printing to stderr
is a good alternative. One can override default_exception_handler() if
needed.
Diffstat (limited to 'extmod/asyncio/core.py')
-rw-r--r-- | extmod/asyncio/core.py | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/extmod/asyncio/core.py b/extmod/asyncio/core.py index be5119ba61..214cc52f45 100644 --- a/extmod/asyncio/core.py +++ b/extmod/asyncio/core.py @@ -272,9 +272,9 @@ class Loop: return Loop._exc_handler def default_exception_handler(loop, context): - print(context["message"]) - print("future:", context["future"], "coro=", context["future"].coro) - sys.print_exception(context["exception"]) + print(context["message"], file=sys.stderr) + print("future:", context["future"], "coro=", context["future"].coro, file=sys.stderr) + sys.print_exception(context["exception"], sys.stderr) def call_exception_handler(context): (Loop._exc_handler or Loop.default_exception_handler)(Loop, context) |