Message353095
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' |
|
Date |
User |
Action |
Args |
2019-09-24 15:30:18 | xtreak | set | recipients:
+ xtreak, serhiy.storchaka, davidparks21 |
2019-09-24 15:30:18 | xtreak | set | messageid: <1569339018.03.0.736032725916.issue38254@roundup.psfhosted.org> |
2019-09-24 15:30:17 | xtreak | link | issue38254 messages |
2019-09-24 15:30:17 | xtreak | create | |
|