---
source: crates/ruff_python_parser/tests/fixtures.rs
input_file: crates/ruff_python_parser/resources/inline/err/try_stmt_misspelled_except.py
---
## AST

```
Module(
    ModModule {
        range: 0..165,
        body: [
            Try(
                StmtTry {
                    range: 0..13,
                    body: [
                        Pass(
                            StmtPass {
                                range: 9..13,
                            },
                        ),
                    ],
                    handlers: [],
                    orelse: [],
                    finalbody: [],
                    is_star: false,
                },
            ),
            AnnAssign(
                StmtAnnAssign {
                    range: 14..20,
                    target: Name(
                        ExprName {
                            range: 14..19,
                            id: "exept",
                            ctx: Store,
                        },
                    ),
                    annotation: Name(
                        ExprName {
                            range: 20..20,
                            id: "",
                            ctx: Invalid,
                        },
                    ),
                    value: None,
                    simple: true,
                },
            ),
            Pass(
                StmtPass {
                    range: 54..58,
                },
            ),
            Pass(
                StmtPass {
                    range: 72..76,
                },
            ),
            Assign(
                StmtAssign {
                    range: 77..82,
                    targets: [
                        Name(
                            ExprName {
                                range: 77..78,
                                id: "a",
                                ctx: Store,
                            },
                        ),
                    ],
                    value: NumberLiteral(
                        ExprNumberLiteral {
                            range: 81..82,
                            value: Int(
                                1,
                            ),
                        },
                    ),
                },
            ),
            Try(
                StmtTry {
                    range: 83..113,
                    body: [
                        Pass(
                            StmtPass {
                                range: 92..96,
                            },
                        ),
                    ],
                    handlers: [
                        ExceptHandler(
                            ExceptHandlerExceptHandler {
                                range: 97..113,
                                type_: None,
                                name: None,
                                body: [
                                    Pass(
                                        StmtPass {
                                            range: 109..113,
                                        },
                                    ),
                                ],
                            },
                        ),
                    ],
                    orelse: [],
                    finalbody: [],
                    is_star: false,
                },
            ),
            AnnAssign(
                StmtAnnAssign {
                    range: 114..120,
                    target: Name(
                        ExprName {
                            range: 114..119,
                            id: "exept",
                            ctx: Store,
                        },
                    ),
                    annotation: Name(
                        ExprName {
                            range: 120..120,
                            id: "",
                            ctx: Invalid,
                        },
                    ),
                    value: None,
                    simple: true,
                },
            ),
            Pass(
                StmtPass {
                    range: 154..158,
                },
            ),
            Assign(
                StmtAssign {
                    range: 159..164,
                    targets: [
                        Name(
                            ExprName {
                                range: 159..160,
                                id: "b",
                                ctx: Store,
                            },
                        ),
                    ],
                    value: NumberLiteral(
                        ExprNumberLiteral {
                            range: 163..164,
                            value: Int(
                                1,
                            ),
                        },
                    ),
                },
            ),
        ],
    },
)
```
## Errors

  |
1 | try:
2 |     pass
3 | exept:  # spellchecker:disable-line
  | ^^^^^ Syntax Error: Expected `except` or `finally` after `try` block
4 |     pass
5 | finally:
  |


  |
1 | try:
2 |     pass
3 | exept:  # spellchecker:disable-line
  |                                    ^ Syntax Error: Expected an expression
4 |     pass
5 | finally:
6 |     pass
  |


  |
2 |     pass
3 | exept:  # spellchecker:disable-line
4 |     pass
  | ^^^^ Syntax Error: Unexpected indentation
5 | finally:
6 |     pass
  |


  |
3 | exept:  # spellchecker:disable-line
4 |     pass
5 | finally:
  |  Syntax Error: Expected a statement
6 |     pass
7 | a = 1
  |


  |
3 | exept:  # spellchecker:disable-line
4 |     pass
5 | finally:
  |        ^ Syntax Error: Expected a statement
6 |     pass
7 | a = 1
  |


  |
3 | exept:  # spellchecker:disable-line
4 |     pass
5 | finally:
  |         ^ Syntax Error: Expected a statement
6 |     pass
7 | a = 1
8 | try:
  |


  |
4 |     pass
5 | finally:
6 |     pass
  | ^^^^ Syntax Error: Unexpected indentation
7 | a = 1
8 | try:
  |


  |
5 | finally:
6 |     pass
7 | a = 1
  |  Syntax Error: Expected a statement
8 | try:
9 |     pass
  |


   |
10 | except:
11 |     pass
12 | exept:  # spellchecker:disable-line
   |                                    ^ Syntax Error: Expected an expression
13 |     pass
14 | b = 1
   |


   |
11 |     pass
12 | exept:  # spellchecker:disable-line
13 |     pass
   | ^^^^ Syntax Error: Unexpected indentation
14 | b = 1
   |


   |
12 | exept:  # spellchecker:disable-line
13 |     pass
14 | b = 1
   |  Syntax Error: Expected a statement
   |
