We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent b197023 commit df6185dCopy full SHA for df6185d
1 file changed
src/tblib/pickling_support.py
@@ -70,7 +70,12 @@ def pickle_exception(
70
}
71
args = ()
72
if isinstance(obj, OSError):
73
- attrs.update(errno=obj.errno, strerror=obj.strerror)
+ # Only set OSError-specific attributes if they are not None
74
+ # Setting them to None explicitly breaks the string representation
75
+ if obj.errno is not None:
76
+ attrs['errno'] = obj.errno
77
+ if obj.strerror is not None:
78
+ attrs['strerror'] = obj.strerror
79
if (winerror := getattr(obj, 'winerror', None)) is not None:
80
attrs['winerror'] = winerror
81
if obj.filename is not None:
0 commit comments