Serhiy Storchaka <storchaka+cpyt...@gmail.com> added the comment:

I think it would be better to pickle `typing.List[int]` as 
`operator.getitem(typing.List, int)`.

    def __reduce__(self):
        if self._special:
            return self._name # __module__ = 'typing'
        index = self._args
        if len(index) == 1:
            index, = index
        return operator.getitem, (self._unparametrized, index)

And there may be a special case for Union. I tried to implement this, but it 
seems to me that parametrized type doesn't have a reference to unparametrized 
type, and I don't know this code enough for writing idiomatic code.

----------

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

Reply via email to