[PATCH V2] posix: insert seek between reads and writes on Solaris (issue4943)

Antoine Pitrou solipsis at pitrou.net
Tue Dec 1 06:54:23 CST 2015


On Tue, 1 Dec 2015 21:39:44 +0900
Yuya Nishihara <yuya at tcha.org> wrote:
> > 
> > See also (from hg's repo):
> > 
> > changeset:   36484:3686fa2b8eee
> > user:        Gregory Szorc <gregory.szorc at gmail.com>
> > date:        Sun Sep 27 18:46:53 2015 -0700
> > summary:     windows: insert file positioning call between reads and writes
> > 
> > Also worth repeating what's in the comments in Mercurial's bug tracker (
> > https://bz.mercurial-scm.org/show_bug.cgi?id=4943) that this issue seems to
> > go away on Python 3.0. I'm pretty sure CPython is automatically inserting
> > the extra seek() call on that Python version to work around platform
> > behavior differences.
> 
> IIRC, Python2 uses a plain old stdio, but Python3 has own buffering mechanism
> called "New I/O". I think the bugs Matt pointed out affect only on the New I/O.

Yes, exactly.  "bufferedio.c" is Python 3's new I/O stack, available in
Python 2 in the "io" module, but standard open() in Python 2 is still
the old fopen()-based implementation.  Python 3 tries to workaround
platform differences by providing consistent semantics -- which is
also why it doesn't rely on the libc's buffered I/O layer anymore.

(I haven't looked at the Mercurial source code lately, but I suppose
it's unlikely to use the new "io" module)

Note there's one other well-known issue with writes in appending mode:
https://bugs.python.org/issue15723

Regards

Antoine.


More information about the Mercurial-devel mailing list