bpo-46644: No longer accept arbitrary callables as type arguments in generics#31159
bpo-46644: No longer accept arbitrary callables as type arguments in generics#31159serhiy-storchaka wants to merge 2 commits into
Conversation
sobolevn
left a comment
There was a problem hiding this comment.
I am +1 on this version of this PR 👍
Sorry, something went wrong.
|
Please don't. This will break future innovation in the type system (e.g., making new typing primitives in typing-extensions). We don't need to be strict about allowed types in the typing.py runtime; that's what static type checkers are for. |
Sorry, something went wrong.
In addition, this breaks cpython internal typeforms that need to be able to pass through |
Sorry, something went wrong.
|
Do typing primitives in typing-extensions subclass any typing class? If yes, it can be included in the list of allowed types. If no, we perhaps could use duck-typing: check for some attributes, like Alternatively we can remove all checks. |
Sorry, something went wrong.
|
Duck typing moves the reason |
Sorry, something went wrong.
https://bugs.python.org/issue46644