[New-bugs-announce] [issue38254] Pickle not deserializing an OSError exception as expected
David Parks
report at bugs.python.org
Sun Sep 22 14:02:44 EDT 2019
New submission from David Parks <davidparks21 at gmail.com>:
Below is a minimum reproducible test case of what appears to be an issue in pickle.
Before pickling the exception ClientConnectionError, from aiohttp, the property ClientConnectionError._os_error is a PermissionError object (a subclass of OSError). After deserialization ClientConnectionError._os_error appears to be a string based on the exception that is produced.
I'm not familiar enough with pickle to make much headway here.
```
import aiohttp
import pickle
connection_key = aiohttp.client_reqrep.ConnectionKey
ose = OSError(1, 'unittest')
cce = aiohttp.client_exceptions.ClientConnectorError(connection_key, ose)
cce_pickled = pickle.dumps(cce)
pickle.loads(cce_pickled)
```
```
Traceback (most recent call last):
File "/opt/.pycharm_helpers/pydev/pydevd.py", line 1758, in <module>
main()
File "/opt/.pycharm_helpers/pydev/pydevd.py", line 1752, in main
globals = debugger.run(setup['file'], None, None, is_module)
File "/opt/.pycharm_helpers/pydev/pydevd.py", line 1147, in run
pydev_imports.execfile(file, globals, locals) # execute the script
File "/opt/.pycharm_helpers/pydev/_pydev_imps/_pydev_execfile.py", line 18, in execfile
exec(compile(contents+"\n", file, 'exec'), glob, loc)
File "/project_neural_mouse/src/ARCHIVE/scratch/scratch_13.py", line 11, in <module>
File "/usr/local/lib/python3.6/dist-packages/aiohttp/client_exceptions.py", line 133, in __init__
super().__init__(os_error.errno, os_error.strerror)
AttributeError: 'str' object has no attribute 'errno'
```
----------
components: Library (Lib)
messages: 352985
nosy: davidparks21
priority: normal
severity: normal
status: open
title: Pickle not deserializing an OSError exception as expected
type: crash
versions: Python 3.6
_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue38254>
_______________________________________
More information about the New-bugs-announce
mailing list