Message368463
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). |
|
Date |
User |
Action |
Args |
2020-05-08 20:54:49 | JelleZijlstra | set | recipients:
+ JelleZijlstra, gvanrossum, serhiy.storchaka, levkivskyi |
2020-05-08 20:54:49 | JelleZijlstra | set | messageid: <1588971289.41.0.376316223792.issue40397@roundup.psfhosted.org> |
2020-05-08 20:54:49 | JelleZijlstra | link | issue40397 messages |
2020-05-08 20:54:49 | JelleZijlstra | create | |
|