-
-
Notifications
You must be signed in to change notification settings - Fork 30.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
…ts`` (#118009) Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
- Loading branch information
1 parent
15b3555
commit 1e3e7ce
Showing
5 changed files
with
81 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
from __future__ import annotations | ||
from typing import Callable | ||
|
||
|
||
class A[T, *Ts, **P]: | ||
x: T | ||
y: tuple[*Ts] | ||
z: Callable[P, str] | ||
|
||
|
||
class B[T, *Ts, **P]: | ||
T = int | ||
Ts = str | ||
P = bytes | ||
x: T | ||
y: Ts | ||
z: P | ||
|
||
|
||
def generic_function[T, *Ts, **P]( | ||
x: T, *y: *Ts, z: P.args, zz: P.kwargs | ||
) -> None: ... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 4 additions & 0 deletions
4
Misc/NEWS.d/next/Library/2024-04-17-22-00-15.gh-issue-114053._JBV4D.rst
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
Fix erroneous :exc:`NameError` when calling :func:`typing.get_type_hints` on | ||
a class that made use of :pep:`695` type parameters in a module that had | ||
``from __future__ import annotations`` at the top of the file. Patch by Alex | ||
Waygood. |