We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent d4b888b commit c10e111Copy full SHA for c10e111
1 file changed
src/attr/_make.py
@@ -786,17 +786,14 @@ def __init__(
786
# BaseException.__reduce__ returns (cls, self.args, state) which calls
787
# cls(*args) on unpickle, but kw_only attrs reject positional args.
788
# Override __reduce__ to use __new__ + state instead of __init__.
789
- if props.is_exception and any(
790
- a.kw_only for a in attrs if a.init
791
- ):
+ if props.is_exception and any(a.kw_only for a in attrs if a.init):
792
_attr_names = self._attr_names
793
794
def __reduce__(self, *, _attr_names=_attr_names):
795
state = {
796
name: getattr(self, name)
797
for name in _attr_names
798
- if name != "__weakref__"
799
- and hasattr(self, name)
+ if name != "__weakref__" and hasattr(self, name)
800
}
801
return (_rebuild_exc, (self.__class__, state))
802
0 commit comments