|
| 1 | +try: |
| 2 | + raise OSError("blah") |
| 3 | +except * ExceptionGroup as e: |
| 4 | + pass |
| 5 | + |
| 6 | + |
| 7 | +try: |
| 8 | + async with trio.open_nursery() as nursery: |
| 9 | + # Make two concurrent calls to child() |
| 10 | + nursery.start_soon(child) |
| 11 | + nursery.start_soon(child) |
| 12 | +except *ValueError: |
| 13 | + pass |
| 14 | + |
| 15 | +try: |
| 16 | + try: |
| 17 | + raise ValueError(42) |
| 18 | + except: |
| 19 | + try: |
| 20 | + raise TypeError(int) |
| 21 | + except *(Exception): |
| 22 | + pass |
| 23 | + 1 / 0 |
| 24 | +except Exception as e: |
| 25 | + exc = e |
| 26 | + |
| 27 | +try: |
| 28 | + try: |
| 29 | + raise FalsyEG("eg", [TypeError(1), ValueError(2)]) |
| 30 | + except \ |
| 31 | + *TypeError as e: |
| 32 | + tes = e |
| 33 | + raise |
| 34 | + except * ValueError as e: |
| 35 | + ves = e |
| 36 | + pass |
| 37 | +except Exception as e: |
| 38 | + exc = e |
| 39 | + |
| 40 | +try: |
| 41 | + try: |
| 42 | + raise orig |
| 43 | + except *(TypeError, ValueError, *OTHER_EXCEPTIONS) as e: |
| 44 | + raise SyntaxError(3) from e |
| 45 | +except BaseException as e: |
| 46 | + exc = e |
| 47 | + |
| 48 | +try: |
| 49 | + try: |
| 50 | + raise orig |
| 51 | + except\ |
| 52 | + * OSError as e: |
| 53 | + raise TypeError(3) from e |
| 54 | +except ExceptionGroup as e: |
| 55 | + exc = e |
| 56 | + |
| 57 | +# output |
| 58 | + |
| 59 | +try: |
| 60 | + raise OSError("blah") |
| 61 | +except* ExceptionGroup as e: |
| 62 | + pass |
| 63 | + |
| 64 | + |
| 65 | +try: |
| 66 | + async with trio.open_nursery() as nursery: |
| 67 | + # Make two concurrent calls to child() |
| 68 | + nursery.start_soon(child) |
| 69 | + nursery.start_soon(child) |
| 70 | +except* ValueError: |
| 71 | + pass |
| 72 | + |
| 73 | +try: |
| 74 | + try: |
| 75 | + raise ValueError(42) |
| 76 | + except: |
| 77 | + try: |
| 78 | + raise TypeError(int) |
| 79 | + except* (Exception): |
| 80 | + pass |
| 81 | + 1 / 0 |
| 82 | +except Exception as e: |
| 83 | + exc = e |
| 84 | + |
| 85 | +try: |
| 86 | + try: |
| 87 | + raise FalsyEG("eg", [TypeError(1), ValueError(2)]) |
| 88 | + except* TypeError as e: |
| 89 | + tes = e |
| 90 | + raise |
| 91 | + except* ValueError as e: |
| 92 | + ves = e |
| 93 | + pass |
| 94 | +except Exception as e: |
| 95 | + exc = e |
| 96 | + |
| 97 | +try: |
| 98 | + try: |
| 99 | + raise orig |
| 100 | + except* (TypeError, ValueError, *OTHER_EXCEPTIONS) as e: |
| 101 | + raise SyntaxError(3) from e |
| 102 | +except BaseException as e: |
| 103 | + exc = e |
| 104 | + |
| 105 | +try: |
| 106 | + try: |
| 107 | + raise orig |
| 108 | + except* OSError as e: |
| 109 | + raise TypeError(3) from e |
| 110 | +except ExceptionGroup as e: |
| 111 | + exc = e |
0 commit comments