[issue12291] file written using marshal in 3.2 can be read by 2.7, but not 3.2 or 3.3
Vinay Sajip
report at bugs.python.org
Sun Jun 19 22:48:41 CEST 2011
Vinay Sajip <vinay_sajip at yahoo.co.uk> added the comment:
> Benjamin Peterson <benjamin at python.org> added the comment:
> > assert(newpos != NULL)
>
> That's because the call is failing. Why?
>
It's seemingly because the Python code did a seek (in Python) which was not
communicated to the FILE object; after reading all objects from the file, a seek
was done to the beginning to start reading again. On the previous call, the FILE
would have been at EOF (at a C level). So it seems as if we have to call ftell
on the Python object at the beginning of the read, and do an fseek to sync the
positions. It's doable, of course, so it's the next thing I'll try, but what I'm
worried about is the thing turning into a bit of a rabbit-hole.
I haven't looked at the io implementation, but for this sort of synchronisation,
it would be better if when based on a FILE object, the io implementation
delegated all its operations to the FILE object - but it doesn't look like
that's the case, and I'm uncomfortable that there may be some undesirable
consequences of that.
----------
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue12291>
_______________________________________
More information about the Python-bugs-list
mailing list