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 <rep...@bugs.python.org> <http://bugs.python.org/issue19630> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com