Skip to content

fix: use typing.List to avoid list() method shadowing on Python 3.14#674

Open
cofin wants to merge 1 commit intolitestar-org:mainfrom
cofin:fix/659-list-annotation
Open

fix: use typing.List to avoid list() method shadowing on Python 3.14#674
cofin wants to merge 1 commit intolitestar-org:mainfrom
cofin:fix/659-list-annotation

Conversation

@cofin
Copy link
Member

@cofin cofin commented Feb 7, 2026

Summary

  • Replace bare list[...] with typing.List[...] in all class annotations where the class defines a list() method
  • Prevents Python 3.14 (PEP 649) lazy annotation evaluation from resolving list to the class method instead of the builtin type
  • Add regression test verifying annotations are accessible via typing.get_type_hints()

Closes #659

On Python 3.14 (PEP 649), lazy annotation evaluation resolves bare
`list[...]` inside classes with a `list()` method to the method instead
of the builtin type. Replace with `typing.List` in all affected class
annotations.

Closes litestar-org#659
@cofin cofin force-pushed the fix/659-list-annotation branch from ccefc3d to aceaf54 Compare February 7, 2026 01:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Bug: Incorrect annotation

1 participant