Jelle Zijlstra <jelle.zijls...@gmail.com> added the comment:

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).

----------
nosy: +Jelle Zijlstra
priority: normal -> release blocker

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue40397>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to