Skip to content

feature: Support PEP 696 type parameter defaults #346

Description

@hartikainen

Did you check the tree-sitter docs?

Is your feature request related to a problem? Please describe.

#308 called for feature requests for unsupported language features. Python 3.13 support PEP 696 defaults in type parameter lists (e.g. class Container[T = str]: ...), but tree-sitter-python parses such declarations into an ERROR node. I expected this syntax to parse successfully alongside the existing PEP 695 support.

Describe the solution you'd like

A focused change covering defaults in class, function, and type-alias declarations would address this without touching unrelated grammar like #315 did.

Describe alternatives you've considered

My downstream usage (rules_python_gazelle_plugin) still works so I just live with the warnings.

Additional context

For reference, there's an existing attempt in #315, which included support for this but was a bit too broad and AI-sloppy. I could contribute a fix but it would also most likely be heavily AI-assisted, albeit higher quality and better scoped.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions