[PATCH] atomictempfile: avoid infinite recursion in destructor

Matt Mackall mpm at selenic.com
Mon Dec 13 13:05:26 CST 2010

On Mon, 2010-12-13 at 13:56 -0500, Greg Ward wrote:
> On Mon, Dec 13, 2010 at 1:10 PM, Matt Mackall <mpm at selenic.com> wrote:
> >> Anyways, I'll give this patch a workout this afternoon and see if
> >> anything goes wrong.  But would you care to explain what you mean by
> >> "issues with posixfile that need to get sorted out"?  I don't *see*
> >> anything fishy from reading the code...
> >
> > See util.posixfile. A posixfile is a file with sensible behavior, as
> > opposed to what open() on Windows gives us.
> You must be referring to the Windows-specific posixfile() in osutil.c.
>  Looks to me like it returns a real genuine Python file object, not a
> file-like object.

Right. If you simply subclass file, you'll get a file opened with
Windows' legacy exclusion semantics (or something like that) on Windows,
which is unfortunate from a Mercurial perspective. Posixfile jumps
through some hoops on Windows to make sure we get sensible behavior. So
the trick is to figure out how to call posixfile from inside our
subclass constructor.

Mathematics is the supreme nostalgia of our time.

More information about the Mercurial-devel mailing list