Patchwork [08,of,11] vfs: fix two setattr calls to use sysstrs

login
register
mail settings
Submitter Augie Fackler
Date March 26, 2017, 10:36 p.m.
Message ID <8d683b05a16a94321d6c.1490567802@imladris.local>
Download mbox | patch
Permalink /patch/19707/
State Accepted
Headers show

Comments

Augie Fackler - March 26, 2017, 10:36 p.m.
# HG changeset patch
# User Augie Fackler <raf@durin42.com>
# Date 1490567343 14400
#      Sun Mar 26 18:29:03 2017 -0400
# Node ID 8d683b05a16a94321d6c891ddc40f1bc3976db64
# Parent  e7fe3ab60132647a9c3b86b2960b385e61b9dcf0
vfs: fix two setattr calls to use sysstrs
Pulkit Goyal - March 27, 2017, 6:21 a.m.
A similar one from Yuya fixing more __setattr__() calls using r''.
https://patchwork.mercurial-scm.org/patch/19683/

On Mon, Mar 27, 2017 at 4:06 AM, Augie Fackler <raf@durin42.com> wrote:

> # HG changeset patch
> # User Augie Fackler <raf@durin42.com>
> # Date 1490567343 14400
> #      Sun Mar 26 18:29:03 2017 -0400
> # Node ID 8d683b05a16a94321d6c891ddc40f1bc3976db64
> # Parent  e7fe3ab60132647a9c3b86b2960b385e61b9dcf0
> vfs: fix two setattr calls to use sysstrs
>
> diff --git a/mercurial/vfs.py b/mercurial/vfs.py
> --- a/mercurial/vfs.py
> +++ b/mercurial/vfs.py
> @@ -480,7 +480,7 @@ class closewrapbase(object):
>      Do not instantiate outside of the vfs layer.
>      """
>      def __init__(self, fh):
> -        object.__setattr__(self, '_origfh', fh)
> +        object.__setattr__(self, pycompat.sysstr('_origfh'), fh)
>
>      def __getattr__(self, attr):
>          return getattr(self._origfh, attr)
> @@ -618,7 +618,8 @@ class checkambigatclosing(closewrapbase)
>      """
>      def __init__(self, fh):
>          super(checkambigatclosing, self).__init__(fh)
> -        object.__setattr__(self, '_oldstat', util.filestat(fh.name))
> +        object.__setattr__(self, pycompat.sysstr('_oldstat'),
> +                           util.filestat(fh.name))
>
>      def _checkambig(self):
>          oldstat = self._oldstat
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel@mercurial-scm.org
> https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
>

Patch

diff --git a/mercurial/vfs.py b/mercurial/vfs.py
--- a/mercurial/vfs.py
+++ b/mercurial/vfs.py
@@ -480,7 +480,7 @@  class closewrapbase(object):
     Do not instantiate outside of the vfs layer.
     """
     def __init__(self, fh):
-        object.__setattr__(self, '_origfh', fh)
+        object.__setattr__(self, pycompat.sysstr('_origfh'), fh)
 
     def __getattr__(self, attr):
         return getattr(self._origfh, attr)
@@ -618,7 +618,8 @@  class checkambigatclosing(closewrapbase)
     """
     def __init__(self, fh):
         super(checkambigatclosing, self).__init__(fh)
-        object.__setattr__(self, '_oldstat', util.filestat(fh.name))
+        object.__setattr__(self, pycompat.sysstr('_oldstat'),
+                           util.filestat(fh.name))
 
     def _checkambig(self):
         oldstat = self._oldstat