[issue14447] marshal.load() reads entire remaining file instead of just next value

Daniel Swanson report at bugs.python.org
Thu Mar 29 22:48:13 CEST 2012


Daniel Swanson <popcorn.tomato.dude at gmail.com> added the comment:

You are correct.
I got:
Python 3.1.2 (release31-maint, Dec  9 2011, 20:50:50) 
[GCC 4.4.5] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import marshall
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: No module named marshall
>>> import marshal
>>> f = open("test", "wb")
>>> marshal.dump(("hello", 1), f)
20
>>> marshal.dump(("there", 2), f)
20
>>> marshal.dump(("friend", 3), f)
21
>>> f.close()
>>> f = open("test", "rb")
>>> print(marshal.load(f))
('hello', 1)
>>> print(marshal.load(f))
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
EOFError: EOF read where object expected
>>>

----------
nosy: +weirdink13

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue14447>
_______________________________________


More information about the Python-bugs-list mailing list