[issue44293] PEP 585 breaks inspect.isclass

2021-06-05 Thread Ivan Levkivskyi
Ivan Levkivskyi added the comment: Uploaded typing_inspect 0.7.0 to PyPI (it should work with Python 3.9 hopefully) -- ___ Python tracker ___ _

[issue44293] PEP 585 breaks inspect.isclass

2021-06-03 Thread Ivan Levkivskyi
Ivan Levkivskyi added the comment: Btw this reminds me I should make a PyPI release of typing_inspect (last release was May 2020), hopefully will make a release on this weekend. -- ___ Python tracker __

[issue44293] PEP 585 breaks inspect.isclass

2021-06-03 Thread Guido van Rossum
Guido van Rossum added the comment: Instead of introspecting types, use this library: https://github.com/ilevkivskyi/typing_inspect -- ___ Python tracker ___ _

[issue44293] PEP 585 breaks inspect.isclass

2021-06-03 Thread Ken Jin
Ken Jin added the comment: @Jelle thanks for nosy-ing me too and the thorough investigation. @Joseph Thanks for taking the time to raise this inconvenience on the bug tracker. > By the way, Python typing is so much unstable (every version breaks the > previous one), it's very complicated to

[issue44293] PEP 585 breaks inspect.isclass

2021-06-03 Thread Joseph Perez
Joseph Perez added the comment: @Jelle Zijlstra Thank you for the explanation. > The current implementation of GenericAlias has been around for a few releases > by now, though, so that change might break some use cases. I agree that a "fix" could have unexpected side-effect, my issue comes q

[issue44293] PEP 585 breaks inspect.isclass

2021-06-02 Thread Guido van Rossum
Guido van Rossum added the comment: Since these are new forms (list[int] previously was an error), does it actually matter? Especially since these are primarily used in annotations. @Joseph Perez, is there a specific library or pattern that is broken by this? FWIW I did think rather carefull

[issue44293] PEP 585 breaks inspect.isclass

2021-06-02 Thread Jelle Zijlstra
Jelle Zijlstra added the comment: The reason for this is that types.GenericAlias.__getattribute__ delegates to the alias's origin (in the `ga_getattro` function). As a result, `list[int].__class__` calls `list.__class__` and returns `type`. And the implementation of `isinstance(obj, type)` u

[issue44293] PEP 585 breaks inspect.isclass

2021-06-02 Thread Joseph Perez
New submission from Joseph Perez : PEP 585 has the side-effect of making `list[int]` an instance of `type`. This is not the case for other generic aliases. It also implies that `inspect.isclass(list[int]) is True`, while `list[int]` is not a class; as a proof of this statement `issubclass(lis