summaryrefslogtreecommitdiff
path: root/tests/functional/t/try_except_raise_crash.py
blob: 48a043493b24808c862163bb1750cd6ae092f5cb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# pylint: disable=missing-docstring,too-many-ancestors, broad-except
import collections.abc
from typing import TYPE_CHECKING, Sized

if TYPE_CHECKING:
    BaseClass = Sized
else:
    BaseClass = collections.abc.Sized


class TestBaseException(BaseClass):
    def __len__(self):
        return 0


class TestException(TestBaseException):
    pass


def test():
    try:
        1 / 0
    except TestException:  # [catching-non-exception,try-except-raise]
        raise
    except Exception:
        pass