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
deepcopy of GenericAlias with __deepcopy__ method is broken #89330
Comments
When deepcopying a parametrized types.GenericAlias (eg: a dict subclass) that has a deepcopy method, the copy module doesn't detect the GenericAlias as a type and instead tries to call cls.deepcopy, passing Example:
shows
I don't know if it's better to update |
I think it is better to narrow the __getattr__. It can break protocols using other special methods. |
Serhiy, can you elaborate how #72493 can break protocols using other special methods? I can't come up with an example. |
I meant that the current __getattr__ breaks deepcopy(). It can break also other protocols. It already has a list of exceptions, we need to add "__copy__" and "__deepcopy__" in this list. Or maybe exclude all dunder names by default and use a white list? |
Thanks, Serhiy! ✨ 🍰 ✨ |
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: