Vinay Sajip <vinay_sa...@yahoo.co.uk> added the comment:

@Benjamin: I missed commenting on your "Why not 0?", but here's the reasoning: 
one can't assume that the file only contains one object to be read, at the 
beginning of the file. It may be that some data is being written to file using 
marshal.dump, interspersed with other data, and then the stream is being read 
in at a later time, with marshal.load called to load a previously saved object. 
In that scenario, why would 0 be always the correct offset value to pass to 
fseek?

I am synchronising the Python object with the FILE *, but not the other way 
around - in the failing case I mentioned, external Python code has positioned 
the io object to zero, but that of course will be overwritten to point the io 
object back to where the FILE object is positioned. Perhaps I just need to go 
the other way ...

I'm not sure how reliable a solution will be which tries to work around there 
apparently being two buffering implementations - at the io level and at the 
FILE level, and trying to keep them synced in a seemingly ad hoc fashion.

It's perfectly possible that I don't know what I'm talking about, so I'd 
welcome an improved patch using the ideas you've suggested. It's been a very 
long time since I wrote C stdio code regularly ;-)

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue12291>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to