Ken Jin <[email protected]> added the comment:
Wow! Thanks, that's an interesting find. My hunch is that we should be passing
in _typevar_types and _paramspec_tvars in the copy_with of _GenericAlias and
_ConcatenateGenericAlias. Inconsistent copy_with could trigger subtle bugs in
ForwardRefs and get_type_hints. I can reproduce a semi-bug right now:
>>> P = ParamSpec('P')
>>> Callable[P, int].__parameters__
(~P,)
>>> Callable[P, int].copy_with((P,int))
typing.Callable[~P, int]
>>> Callable[P, int].copy_with((P,int)).__parameters__
()
^ This shouldn't be empty!!
Would you like to submit a patch for this?
----------
_______________________________________
Python tracker <[email protected]>
<https://bugs.python.org/issue46581>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com