Matt B <eb3f73+python+...@yaymail.com> added the comment:

I am happy to attempt a patch, but I don't understand what's going on with 
_ConcatenateGenericAlias. Or rather, I don't fully understand the various 
copy_with semantics. This code is *very* hard to follow.

Patching _GenericAlias.copy_with seems relatively straightforward:

     def copy_with(self, params):
-        return self.__class__(self.__origin__, params, name=self._name, 
inst=self._inst)
+        return self.__class__(self.__origin__, params, name=self._name, 
inst=self._inst,
+                              _typevar_types=self._typevar_types,
+                              _paramspec_tvars=self._paramspec_tvars)

_ConcatenateGenericAlias.copy_with, on the other hand, appears to return a 
tuple rather than a type until it falls back to the parent implementation. What 
does one do with that?

Also, what about _AnnotatedAlias, _SpecialGenericAlias, _UnionGenericAlias, or 
_strip_annotations? Do any of those need to be modified?

I can't find any tests that deal with copy_with directly, so I'm assuming its 
use is stressed via higher level code paths, but it's not clear what use cases 
that method is supposed to serve. The good news is that its use is confined to 
typing.py. The bad news is that file gives little insight to those who aren't 
already experts in that territory.

In short, I will do my best, but I suspect I will need patience and guidance in 
arriving something acceptable.

----------

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

Reply via email to