Closed takluyver closed 1 year ago
I realised this doesn't work after all, because all the hooks are specified as returning something if defined, and they can't do that with an uncaught exception bubbling up. It will have to be caught in setuptools.
E.g. setuptools' hooks call
setup.py
in process, and the code in there may callsys.exit()
even when there's no error. Maybe setuptools should catch this, but the spec doesn't say, and catching it here can protect against any similar cases from other backends.Code calling
os._exit(0)
, which bypasses any Python handling, will still fail, but if anyone's doing that, they can deal with the consequences themselves.@pfmoore suggested catching all errors in the hooks and putting the traceback in the JSON. That's not unthinkable, but we already have a way to handle such cases - the frontend gets a
CalledProcessError
(or a similar exception from its custom subprocess runner) and should ensure that at least stderr from the backend is available somewhere for debugging. This is valuable because it also covers errors that aren't Python exceptions (e.g. segfaults), and may have additional context besides the traceback, like logged messages.