Message398842
Thank you Ken Jin. So the problem is the __args__ (x, str) is interpreted differently depending on x, and after substituting x the interpretation can be changed. If x was ParamSpec, it was interpreted in one way, but if it becomes int, it is now interpreted in other way.
The solution is to forbid substitution of P with wrong values (not parameters expression). Some normalization is also needed, before and after substitution.
Other related example is:
>>> from typing import *
>>> P = ParamSpec("P")
>>> class Z(Generic[P]): pass
...
>>> A = Z[[int]]
>>> B = Z[int]
>>> A
__main__.Z[(<class 'int'>,)]
>>> B
__main__.Z[int]
>>> A.__args__
((<class 'int'>,),)
>>> B.__args__
(<class 'int'>,)
It is expected that A and B should the same. |
|
Date |
User |
Action |
Args |
2021-08-03 17:46:04 | serhiy.storchaka | set | recipients:
+ serhiy.storchaka, gvanrossum, kj |
2021-08-03 17:46:04 | serhiy.storchaka | set | messageid: <1628012764.61.0.155590008376.issue44801@roundup.psfhosted.org> |
2021-08-03 17:46:04 | serhiy.storchaka | link | issue44801 messages |
2021-08-03 17:46:04 | serhiy.storchaka | create | |
|