This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author vstinner
Recipients mariocj89, vstinner
Date 2020-11-10.13:45:06
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1605015906.51.0.572061456488.issue42308@roundup.psfhosted.org>
In-reply-to
Content
Can't you do that in your own hook? For example:

orig_hook = threading.excepthook
threading.excepthook = myhook

def myhook(args):
   try:
      ...
   except:
      print("too bad!")
      orig_hook(args)


I found one interesting usage of sys.__excepthook__ in code.InteractiveInterpreter:

        if sys.excepthook is sys.__excepthook__:
            lines = traceback.format_exception_only(type, value)
            self.write(''.join(lines))
        else:
            # If someone has set sys.excepthook, we let that take precedence
            # over self.write
            sys.excepthook(type, value, tb)

So it seems like sys.__excepthook__ is useful ;-)
History
Date User Action Args
2020-11-10 13:45:06vstinnersetrecipients: + vstinner, mariocj89
2020-11-10 13:45:06vstinnersetmessageid: <1605015906.51.0.572061456488.issue42308@roundup.psfhosted.org>
2020-11-10 13:45:06vstinnerlinkissue42308 messages
2020-11-10 13:45:06vstinnercreate