Karthikeyan Singaravelan <tir.kar...@gmail.com> added the comment:

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'

----------
nosy: +xtreak

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue38254>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to