File gets truncated upon unpickling
Opened this issue · 0 comments
JanPokorny commented
It seems that whenever a file is open for writing in the session, the (already closed) file object f
gets unpickled in such a way that re-opens the file in writing mode, effectively truncating the file to zero length.
Is this expected behavior?
❯ python -c "
with open('file.txt', 'w') as f:
f.write('hello world')
import dill
dill.dump_module('session.pkl')
"
❯ cat file.txt
hello world⏎
❯ python -c "
import dill
dill.load_module('session.pkl')
"
❯ cat file.txt
❯