[issue43148] Call sys.unraisablehook in the REPL when sys.excepthook is broken

2021-02-15 Thread Julian Berman


Julian Berman  added the comment:

Thanks Victor. Yes likely happy to send a PR (have to clear a few things
off the yak stack first)

On Tue, Feb 9, 2021 at 5:38 AM STINNER Victor 
wrote:

>
> STINNER Victor  added the comment:
>
> It makes sense to call _PyErr_WriteUnraisableMsg() when sys.excepthook
> raise a new exception. Do you want to propose a PR for that?
>
> sys.excepthook documentation mentions sys.unraisablehook:
> https://docs.python.org/dev/library/sys.html#sys.excepthook
>
> threading._make_invoke_excepthook logs threading.excepthook failure using
> sys.excepthook.
>
> Note: Carl also suggested to add a way to invoke sys.unraisablehook
> explicitly, not only for testing purpose. It would help in some cases.
>
> --
>
> ___
> Python tracker 
> 
> ___
>

--
nosy: +Julian2

___
Python tracker 

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



[issue43148] Call sys.unraisablehook in the REPL when sys.excepthook is broken

2021-02-09 Thread STINNER Victor


STINNER Victor  added the comment:

It makes sense to call _PyErr_WriteUnraisableMsg() when sys.excepthook raise a 
new exception. Do you want to propose a PR for that?

sys.excepthook documentation mentions sys.unraisablehook:
https://docs.python.org/dev/library/sys.html#sys.excepthook

threading._make_invoke_excepthook logs threading.excepthook failure using 
sys.excepthook.

Note: Carl also suggested to add a way to invoke sys.unraisablehook explicitly, 
not only for testing purpose. It would help in some cases.

--

___
Python tracker 

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



[issue43148] Call sys.unraisablehook in the REPL when sys.excepthook is broken

2021-02-06 Thread Carl Friedrich Bolz-Tereick


Change by Carl Friedrich Bolz-Tereick :


--
nosy: +Carl.Friedrich.Bolz

___
Python tracker 

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



[issue43148] Call sys.unraisablehook in the REPL when sys.excepthook is broken

2021-02-06 Thread Julian Berman

New submission from Julian Berman :

At the REPL, when sys.excepthook is broken (below by setting it to a 
non-callable), one sees:

```
⊙  python3.9

julian@Airm
Python 3.9.1 (default, Feb  2 2021, 22:54:59) 
[Clang 12.0.0 (clang-1200.0.32.29)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import sys; sys.excepthook = object(); asdf
Error in sys.excepthook:
TypeError: 'object' object is not callable

Original exception was:
Traceback (most recent call last):
  File "", line 1, in 
NameError: name 'asdf' is not defined
```

The implementation 
(https://github.com/python/cpython/blob/5f18c223391eef8c7d01241b51a7b2429609dd84/Python/pythonrun.c#L805-L817)
 seems to do so by reimplementing something like 3.8+'s sys.unraisablehook 
(well, technically it predates sys.unraisablehook by quite a while).

Seems like now that it exists, that code should now call sys.unraisablehook.

--
messages: 386569
nosy: Julian, vstinner
priority: normal
severity: normal
status: open
title: Call sys.unraisablehook in the REPL when sys.excepthook is broken
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