Joseph Perez <jope...@hotmail.fr> added the comment:

Indeed, sorry, my example was bad. My library was raising at several place, and 
I've extrapolated about generic substitution.

I've indeed other substitutions (without `TypeVar`), and because they were 
failing, I've assumed that all of my substitutions were failing; I was wrong 
about generic one.

For example, if I want to substitute `int | Collection[int]` to `int | 
list[int]`, I will have to replace `types.UnionType` by `typing.Union` or use 
`reduce`, while it was not necessary in 3.9 where I could just write 
`get_origin(tp)[new_args]`.

So I'll have to add some `if` in my code.

----------
stage:  -> resolved
status: pending -> closed

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

Reply via email to