This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author xtreak
Recipients davidparks21, serhiy.storchaka, xtreak
Date 2019-09-24.15:30:17
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1569339018.03.0.736032725916.issue38254@roundup.psfhosted.org>
In-reply-to
Content
A simplified example to reproduce the issue as below. It seems that the OSError instance passed to the constructor is pickled such that during unpickling the string part of OSError 'unittest' is passed to the constructor instead of the original OSError object.


import pickle

ose = OSError(1, 'unittest')

class SubOSError(OSError):

    def __init__(self, foo, os_error):
        super().__init__(os_error.errno, os_error.strerror)

cce = SubOSError(1, ose)
cce_pickled = pickle.dumps(cce)
pickle.loads(cce_pickled)


./python.exe ../backups/bpo38254.py
Traceback (most recent call last):
  File "/Users/karthikeyansingaravelan/stuff/python/cpython/../backups/bpo38254.py", line 12, in <module>
    pickle.loads(cce_pickled)
  File "/Users/karthikeyansingaravelan/stuff/python/cpython/../backups/bpo38254.py", line 8, in __init__
    super().__init__(os_error.errno, os_error.strerror)
AttributeError: 'str' object has no attribute 'errno'
History
Date User Action Args
2019-09-24 15:30:18xtreaksetrecipients: + xtreak, serhiy.storchaka, davidparks21
2019-09-24 15:30:18xtreaksetmessageid: <1569339018.03.0.736032725916.issue38254@roundup.psfhosted.org>
2019-09-24 15:30:17xtreaklinkissue38254 messages
2019-09-24 15:30:17xtreakcreate