Author wrmsr
Recipients gvanrossum, levkivskyi, miss-islington, ned.deily, serhiy.storchaka, wrmsr
Date 2018-04-04.21:47:35
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1522878455.61.0.682650639539.issue32873@psf.upfronthosting.co.za>
In-reply-to
Content
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).
History
Date User Action Args
2018-04-04 21:47:35wrmsrsetrecipients: + wrmsr, gvanrossum, ned.deily, serhiy.storchaka, levkivskyi, miss-islington
2018-04-04 21:47:35wrmsrsetmessageid: <1522878455.61.0.682650639539.issue32873@psf.upfronthosting.co.za>
2018-04-04 21:47:35wrmsrlinkissue32873 messages
2018-04-04 21:47:35wrmsrcreate