[issue19630] marshal.dump cannot write to temporary file
Tim Golden
report at bugs.python.org
Sun Nov 17 11:58:36 CET 2013
Tim Golden added the comment:
marshal.c does a check that the 2nd arg is a subclass of the builtin file class. On non-Posix platforms, TemporaryFile is a wrapper class providing context manager support for delete-on-close. This fails the subclass test.
The docs for TemporaryFile:
http://docs.python.org/2/library/tempfile.html?highlight=temporaryfile#tempfile.TemporaryFile
do state that, on non-Posix systems, the object is not a true file. The docs for marshal:
http://docs.python.org/2/library/marshal.html?highlight=marshal#marshal.dump
more or less state the 2nd param must be a true file object. So I think we're within rights here. But I accept that it's not an ideal. The best we can opt for here, I think, is a doc patch to marshal.dump reinforcing that the file must a true file.
BTW, why are you marshalling into a file which will be deleted as soon as it's closed?
----------
nosy: +tim.golden
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue19630>
_______________________________________
More information about the Python-bugs-list
mailing list