Skip to content

Commit

Permalink
fix runtime error on python<3.9
Browse files Browse the repository at this point in the history
  • Loading branch information
jakkdl committed Dec 23, 2023
1 parent cc1f85d commit 5f89835
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/exceptiongroup/_suppress.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,19 @@
import sys
from contextlib import AbstractContextManager
from types import TracebackType
from typing import Type
from typing import TYPE_CHECKING, Type

if sys.version_info < (3, 11):
from ._exceptions import BaseExceptionGroup

if TYPE_CHECKING:
# requires python 3.9
BaseClass = AbstractContextManager[None]
else:
BaseClass = AbstractContextManager

class suppress(AbstractContextManager[None]):

class suppress(BaseClass):
"""Backport of :class:`contextlib.suppress` from Python 3.12.1."""

def __init__(self, *exceptions: BaseException):
Expand Down

0 comments on commit 5f89835

Please sign in to comment.