-
Notifications
You must be signed in to change notification settings - Fork 237
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Can't copy.copy or deepcopy any type that inherits from _FinalTypingBase #306
Comments
Hm, there are tests for pickling, I guess they are incomplete. :-( @ilevkivskyi thoughts? |
@gvanrossum Yes, this could be fixed simply by adding a trivial By the way, I think we could not make subscripted generics like |
We typically allow pickles to reference classes by (fully-qualified) name,
so I don't see why we shouldn't allow that here.
|
@gvanrossum The problem is not with being qualified. Anyway, there are no problems with |
IIRC there are other APIs to override pickling. See the pickle docs, I haven't used them in ages. :-( |
(Or maybe you'd need to add pickle support to the metaclass? I'm reaching here, out of time, and I'm not sure it's worth it trying to support pickling of |
copy.copy
any type that inherits from _FinalTypingBase
I (== OP) personally won't mind waiting for the right fix if supporting both pickling and copying is an entangled issue, and if it doesn't make sense to support just copying. Currently I can workaround this issue without much impact (don't type-annotate this arg, only copy after doing that, etc.). |
I do not think this was really solved: https://github.com/python/typing/pull/311/files#r132876422 |
Appears to be since #283, according to git bisect.
To repro:
Motivation for copying a type: deepcopying a function's
__annotations__
makes it possible to do manipulations on the annotations to get only the data you want, like type annotations for just the function arguments.The text was updated successfully, but these errors were encountered: