New submission from Matt Chaput <[email protected]>:
In Python 3.2, if you write several values to a file with multiple calls to
marshal.dump(), and then try to read them back, the first marshal.load()
returns the first value, but reads to the end of the file, so subsequent calls
to marshal.load() raise an EOFError.
E.g.:
import marshal
f = open("test", "wb")
marshal.dump(("hello", 1), f)
marshal.dump(("there", 2), f)
marshal.dump(("friend", 3), f)
f.close()
f = open("test", "rb")
print(marshal.load(f)) # ('hello', 1)
print(marshal.load(f)) # ERROR
This page seems to indicate this was also a bug in Python 3.1:
http://www.velocityreviews.com/forums/t728526-python-3-1-2-and-marshal.html
----------
components: IO
messages: 157093
nosy: mattchaput
priority: normal
severity: normal
status: open
title: marshal.load() reads entire remaining file instead of just next value
type: behavior
versions: Python 3.1, Python 3.2
_______________________________________
Python tracker <[email protected]>
<http://bugs.python.org/issue14447>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com