Will T <timwillo...@gmail.com> added the comment:

I believe I hit a bug with this fix (just pulled the code a few min ago):

    In [10]: pickle.loads(pickle.dumps(typing.List))
    Out[10]: typing.List

    In [11]: pickle.loads(pickle.dumps(typing.FrozenSet))
    ---------------------------------------------------------------------------
    PicklingError                             Traceback (most recent call last)
    <ipython-input-11-be060c6090e3> in <module>()
    ----> 1 pickle.loads(pickle.dumps(typing.FrozenSet))

    PicklingError: Can't pickle typing.Frozenset: attribute lookup Frozenset on 
typing failed

The cause is in _GenericAlias.__init__

            name = orig_name[0].title() + orig_name[1:]

Maybe just pass the name explicitly?

For context I originally hit this trying to explicitly getattr(typing, 
alias_name) not by pickling but I'm pleased to see that's at least apparently 
intended to be valid use (I need to get the underlying special's parameter 
variance which is lost when you give it args).

----------
nosy: +wrmsr

_______________________________________
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