Skip to content
Snippets Groups Projects
Commit 68ea1f8d authored by Matt Harbison's avatar Matt Harbison
Browse files

py3: proxy posixfile objects to re-add a useful 'name' attribute on Windows

This file object is used in the vfs layer, so there are many errors like this:

    ...
      File "mercurial\localrepo.py", line 2569, in savecommitmessage
        return self.pathto(fp.name[len(self.root) + 1:])
    TypeError: 'int' object is not subscriptable

It looks like the 'name' value is actually the fileno() value, and the
documentation says the name parameter to PyFile_FromFd() is ignored. [1]  I
tried just assigning the attribute after osutil.posixfile() returns, but that
crashes saying that it's read-only.

[1] https://docs.python.org/3.6/c-api/file.html
parent fb628c04
No related branches found
No related tags found
No related merge requests found
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment