Add workaround for for segfaults caused by faulthandler generating stack traces without holding the GIL, so sometimes the thread state or stack frame data would be freed whilst it was being traversed. Now uses `faulthandler.dump_traceback` directly with the GIL held.
(see https://github.com/python/cpython/issues/116008)