-
-
Notifications
You must be signed in to change notification settings - Fork 367
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
Inheriting from Exception breaks deepcopy on Python 2 #217
Comments
Turns out this isn't attrs related, it's just Python 2 😩 : >>> from copy import deepcopy
>>> class Foo(Exception):
... def __init__(self, bar):
... self.bar = bar
...
>>> deepcopy(Foo(1))
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/Cellar/python/2.7.13/Frameworks/Python.framework/Versions/2.7/lib/python2.7/copy.py", line 190, in deepcopy
y = _reconstruct(x, rv, 1, memo)
File "/usr/local/Cellar/python/2.7.13/Frameworks/Python.framework/Versions/2.7/lib/python2.7/copy.py", line 329, in _reconstruct
y = callable(*args)
TypeError: __init__() takes exactly 2 arguments (1 given)
>>> |
May I suggest Python 3.6? ;) |
I wish 😭 Migrating monoliths with poor test coverage will not be fun.. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
attrs classes that inherit from
Exception
on Python 2 cannot be deep copied:Python 2.7.13, attrs 16.3.0, 17.2.0,and 50107f6 .
This is not an issue on Python 3:
The text was updated successfully, but these errors were encountered: