This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author JelleZijlstra
Recipients JelleZijlstra, gvanrossum, levkivskyi, serhiy.storchaka
Date 2020-05-08.20:54:49
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1588971289.41.0.376316223792.issue40397@roundup.psfhosted.org>
In-reply-to
Content
The most recent change here caused a regression. The following file:

```
from typing import Generic, TypeVar, Union

class CannotTransform(Exception): pass

T = TypeVar("T")
E = TypeVar("E", bound=Exception)

class Ok(Generic[T]): pass
class Err(Generic[E]): pass

Result = Union[Ok[T], Err[E]]
TResult = Result[T, CannotTransform]
TMatchResult = TResult[int]
```

Now fails with:

```
Traceback (most recent call last):
  File "/Users/jzijlstra-mpbt/py/cpython/Lib/../../black/black.py", line 22, in <module>
    TMatchResult = TResult[int]
  File "/Users/jzijlstra-mpbt/py/cpython/Lib/typing.py", line 244, in inner
    return func(*args, **kwds)
  File "/Users/jzijlstra-mpbt/py/cpython/Lib/typing.py", line 704, in __getitem__
    arg = arg[subargs]
  File "/Users/jzijlstra-mpbt/py/cpython/Lib/typing.py", line 244, in inner
    return func(*args, **kwds)
  File "/Users/jzijlstra-mpbt/py/cpython/Lib/typing.py", line 695, in __getitem__
    _check_generic(self, params)
  File "/Users/jzijlstra-mpbt/py/cpython/Lib/typing.py", line 194, in _check_generic
    raise TypeError(f"{cls} is not a generic class")
TypeError: __main__.Err[__main__.CannotTransform] is not a generic class
```

Before commit c1c7d8ead9eb214a6149a43e31a3213c52448877 it was fine. This was found when we added 3.9-dev to CI for Black (https://github.com/psf/black/pull/1393).
History
Date User Action Args
2020-05-08 20:54:49JelleZijlstrasetrecipients: + JelleZijlstra, gvanrossum, serhiy.storchaka, levkivskyi
2020-05-08 20:54:49JelleZijlstrasetmessageid: <1588971289.41.0.376316223792.issue40397@roundup.psfhosted.org>
2020-05-08 20:54:49JelleZijlstralinkissue40397 messages
2020-05-08 20:54:49JelleZijlstracreate