Skip to content

Commit 761ec2a

Browse files
jakkdlTeamSpen210
authored andcommitted
Remove special handling due to IPython lacking support for exception groups
1 parent 1c15500 commit 761ec2a

File tree

1 file changed

+1
-34
lines changed

1 file changed

+1
-34
lines changed

trio/_core/_multierror.py

Lines changed: 1 addition & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,7 @@
1111
from trio._deprecate import warn_deprecated
1212

1313
if sys.version_info < (3, 11):
14-
from exceptiongroup import BaseExceptionGroup, ExceptionGroup, print_exception
15-
else:
16-
from traceback import print_exception
14+
from exceptiongroup import BaseExceptionGroup, ExceptionGroup
1715

1816
if TYPE_CHECKING:
1917
from typing_extensions import Self
@@ -461,37 +459,6 @@ def concat_tb(
461459
return current_head
462460

463461

464-
# Remove when IPython gains support for exception groups
465-
# (https://github.com/ipython/ipython/issues/13753)
466-
if "IPython" in sys.modules:
467-
import IPython
468-
469-
ip = IPython.get_ipython()
470-
if ip is not None:
471-
if ip.custom_exceptions != ():
472-
warnings.warn(
473-
"IPython detected, but you already have a custom exception "
474-
"handler installed. I'll skip installing Trio's custom "
475-
"handler, but this means exception groups will not show full "
476-
"tracebacks.",
477-
category=RuntimeWarning,
478-
)
479-
else:
480-
481-
def trio_show_traceback(
482-
self: IPython.core.interactiveshell.InteractiveShell,
483-
etype: type[BaseException],
484-
value: BaseException,
485-
tb: TracebackType,
486-
tb_offset: int | None = None,
487-
) -> None:
488-
# XX it would be better to integrate with IPython's fancy
489-
# exception formatting stuff (and not ignore tb_offset)
490-
print_exception(value)
491-
492-
ip.set_custom_exc((BaseExceptionGroup,), trio_show_traceback)
493-
494-
495462
# Ubuntu's system Python has a sitecustomize.py file that import
496463
# apport_python_hook and replaces sys.excepthook.
497464
#

0 commit comments

Comments
 (0)