|
11 | 11 | from trio._deprecate import warn_deprecated |
12 | 12 |
|
13 | 13 | 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 |
17 | 15 |
|
18 | 16 | if TYPE_CHECKING: |
19 | 17 | from typing_extensions import Self |
@@ -461,37 +459,6 @@ def concat_tb( |
461 | 459 | return current_head |
462 | 460 |
|
463 | 461 |
|
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 | | - |
495 | 462 | # Ubuntu's system Python has a sitecustomize.py file that import |
496 | 463 | # apport_python_hook and replaces sys.excepthook. |
497 | 464 | # |
|
0 commit comments