Skip to content

Commit

Permalink
Allow using typing_extensions.TypeVar in stubs (#486)
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexWaygood authored May 9, 2024
1 parent f60d7e3 commit 9c4a5d8
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 1 deletion.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# Change Log

## Unreleased

Bugfixes
* Allow the use of `typing_extensions.TypeVar` in stubs.
`typing_extensions.TypeVar` has the *default* parameter,
which only exists on Python 3.13+ when using `typing.TypeVar`.

## 24.4.1

New error codes:
Expand Down
1 change: 0 additions & 1 deletion pyi.py
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,6 @@ def all_equal(iterable: Iterable[object]) -> bool:
"SupportsInt",
"SupportsRound",
"TypedDict",
"TypeVar",
"final",
"overload",
"NoReturn",
Expand Down
1 change: 1 addition & 0 deletions tests/imports.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,7 @@ from collections.abc import ByteString # Y057 Do not use collections.abc.ByteSt
# GOOD ATTRIBUTE ACCESS
foo: typing.SupportsIndex
baz: re.Pattern[str]
_T = typing_extensions.TypeVar("_T", default=bool | None) # Y018 TypeVar "_T" is not used

@typing.final
def bar(arg: collections.abc.Sized) -> typing.Literal[True]: ...
Expand Down

0 comments on commit 9c4a5d8

Please sign in to comment.