Vinay Sajip <vinay_sa...@yahoo.co.uk> added the comment: > Benjamin Peterson <benja...@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 <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