Register multiple excepthooks?
avi.e.gross at gmail.com
avi.e.gross at gmail.com
Sun Jul 31 22:43:49 EDT 2022
Albert-Jan,
Unless there is something special in your scenario, aren't there many ways
within python proper to create functions that effectively call another
function or more as needed? Think decorators as one example.
Of course if the caller expects some specific result when it calls your
function, running a single function that returns say the value of the last
thing it does, may not meet your needs.
Now assuming all your functions take the same required argument and do not
in any way tamper with the argument, you could indeed define a function that
accepts arguments and internally calls one after another other functions in
some order and intercepts anything they return (or errors) and consolidates
them as needed and returns a result. I suspect there is a module that
provides such functionality.
-----Original Message-----
From: Python-list <python-list-bounces+avi.e.gross=gmail.com at python.org> On
Behalf Of Albert-Jan Roskam
Sent: Sunday, July 31, 2022 5:40 AM
To: Python-list at python.org
Subject: Register multiple excepthooks?
Hi,
I have a function init_logging.log_uncaught_errors() that I use for
sys.excepthook. Now I also want to call another function (ffi.dlclose())
upon abnormal termination. Is it possible to register multiple
excepthooks, like with atexit.register? Or should I rename/redefine
log_uncaught_errors() so it does both things?
Thanks!
Albert-Jan
--
https://mail.python.org/mailman/listinfo/python-list
More information about the Python-list
mailing list