[issue42308] Add threading.__excepthook__ similar to sys.__excepthook__

2020-11-12 Thread STINNER Victor


STINNER Victor  added the comment:

PR merged, thanks Mario.

--
resolution:  -> fixed
stage: patch review -> resolved
status: open -> closed

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue42308] Add threading.__excepthook__ similar to sys.__excepthook__

2020-11-12 Thread STINNER Victor


STINNER Victor  added the comment:


New changeset 750c5abf43b7b1627ab59ead237bef4c2314d29e by Mario Corchero in 
branch 'master':
bpo-42308: Add threading.__excepthook__ (GH-23218)
https://github.com/python/cpython/commit/750c5abf43b7b1627ab59ead237bef4c2314d29e


--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue42308] Add threading.__excepthook__ similar to sys.__excepthook__

2020-11-10 Thread Mario Corchero


Mario Corchero  added the comment:

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

That is exactly what I wished this was there for hehe. We are installing a 
custom version of excepthook and wanted to check if the user had changed it.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue42308] Add threading.__excepthook__ similar to sys.__excepthook__

2020-11-10 Thread STINNER Victor


STINNER Victor  added the comment:

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 ;-)

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue42308] Add threading.__excepthook__ similar to sys.__excepthook__

2020-11-10 Thread Mario Corchero


Change by Mario Corchero :


--
keywords: +patch
pull_requests: +22116
stage:  -> patch review
pull_request: https://github.com/python/cpython/pull/23218

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue42308] Add threading.__excepthook__ similar to sys.__excepthook__

2020-11-10 Thread Mario Corchero


New submission from Mario Corchero :

The sys module contains __excepthook__ to recover sys.excepthook if necessary. 
The same is not present in the threading module, even if threading.excepthook 
is exposed.

--
components: Library (Lib)
messages: 380651
nosy: mariocj89, vstinner
priority: normal
severity: normal
status: open
title: Add threading.__excepthook__ similar to sys.__excepthook__
versions: Python 3.10

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com