Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 34k
Closed
Labels
3.10only security fixesonly security fixes3.11only security fixesonly security fixes3.12only security fixesonly security fixesstdlibStandard Library Python modules in the Lib/ directoryStandard Library Python modules in the Lib/ directorytopic-typingtype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or errortype-crashA hard crash of the interpreter, possibly with a core dumpA hard crash of the interpreter, possibly with a core dump
Description
fromtypingimportTypeVar, Generic, CallableT=TypeVar("T") P=TypeVar("P") classTest(Generic[T]): ... S=Callable[[Test], P] deftest(arg: S[T]): ...On python3.11 i can't run this code. Code falls on an attempt to parameterize S
Traceback:
Traceback (most recent call last): File "C:\Users\KIRILL-1\PycharmProjects\dataclass_factory\exp.py", line 12, in <module> def test(arg: S[T]): ... ~^^^ File "C:\Users\KIRILL-1\AppData\Local\Programs\Python\Python311\Lib\typing.py", line 360, in inner return cached(*args, **kwds) ^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\KIRILL-1\AppData\Local\Programs\Python\Python311\Lib\typing.py", line 1391, in __getitem__ new_args = self._determine_new_args(args) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\KIRILL-1\AppData\Local\Programs\Python\Python311\Lib\typing.py", line 1440, in _determine_new_args subargs.append(new_arg_by_param[x]) ~~~~~~~~~~~~~~~~^^^ KeyError: ~T How i understand, in 3.11, an attempt is being made to parameterize Test in S, but in 3.10 - not
Is it new behavior or a bug?
Yourun-proger
Metadata
Metadata
Assignees
Labels
3.10only security fixesonly security fixes3.11only security fixesonly security fixes3.12only security fixesonly security fixesstdlibStandard Library Python modules in the Lib/ directoryStandard Library Python modules in the Lib/ directorytopic-typingtype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or errortype-crashA hard crash of the interpreter, possibly with a core dumpA hard crash of the interpreter, possibly with a core dump