Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

exception information missing from unraisable exceptiongroups #18

Open
graingert opened this issue Aug 2, 2022 · 6 comments · May be fixed by #21
Open

exception information missing from unraisable exceptiongroups #18

graingert opened this issue Aug 2, 2022 · 6 comments · May be fixed by #21

Comments

@graingert
Copy link

python/cpython#95572

Python 3.10.4 (main, Jun 29 2022, 12:14:53) [GCC 11.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import exceptiongroup
>>> class Foo:
...     def __del__(self):
...         raise exceptiongroup.BaseExceptionGroup("the bad", [Exception("critical debug information")])
... 
>>> f = Foo()
>>> del f
Exception ignored in: <function Foo.__del__ at 0x7f5823e49870>
Traceback (most recent call last):
  File "<stdin>", line 3, in __del__
exceptiongroup.ExceptionGroup: the bad (1 sub-exception)
@graingert
Copy link
Author

this is particularly irritating in the backport because we can't just fix the default unraisable hook

@agronholm
Copy link
Owner

Can we fix this at all then?

@graingert
Copy link
Author

we could offer a fixed version of sys.unraisablehook that people could install?

@agronholm
Copy link
Owner

Maybe, when installing the normal exception hook we could check if sys.unraisablehook has been modified, and if it hasn't, install our own.

@agronholm
Copy link
Owner

Hmm...what should the output look like?

@agronholm
Copy link
Owner

Best I could do so far was:

Exception ignored in: <function Foo.__del__ at 0x7f30a6f85fc0>
  File "/home/alex/workspace/exceptiongroup/exctest3.py", line 9, in __del__
    raise ExceptionGroup(
  + Exception Group Traceback (most recent call last):
  |   File "/home/alex/workspace/exceptiongroup/exctest3.py", line 9, in __del__
  |     raise ExceptionGroup(
  | exceptiongroup.ExceptionGroup: the bad (1 sub-exception)
  +-+---------------- 1 ----------------
    | Exception: critical debug information
    +------------------------------------

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants