Skip to content

Add support for Python 3.14 multi-exception syntax #10546

@erictraut

Description

@erictraut

Python 3.14 relaxes the syntax for except clauses that accept multiple exception types but do not use an as clause. Previously, parentheses were required in this case, but 3.14 eliminates this requirement.

def divide(a, b):
    try:
        result = a / b
        return result
    except ZeroDivisionError, TypeError: # No Parens needed here (unless there's an as clause)
        print(f"Wrong input: {a} and {b}")
        raise

See PEP 758 for details.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions