# HG changeset patch # User Yuya Nishihara # Date 1490513592 -32400 # Node ID f80d9ddc40f3e06b8783c2b18c59b0876376a7a0 # Parent 6ceb3c4c3ab6e4caf68c3ba0909878896af0faac py3: abuse r'' to preserve str-ness of literals passed to __setattr__() diff -r 6ceb3c4c3ab6 -r f80d9ddc40f3 mercurial/demandimport.py --- a/mercurial/demandimport.py Sun Mar 26 17:12:06 2017 +0900 +++ b/mercurial/demandimport.py Sun Mar 26 16:33:12 2017 +0900 @@ -76,9 +76,9 @@ else: head = name after = [] - object.__setattr__(self, "_data", + object.__setattr__(self, r"_data", (head, globals, locals, after, level, set())) - object.__setattr__(self, "_module", None) + object.__setattr__(self, r"_module", None) def _extend(self, name): """add to the list of submodules to load""" self._data[3].append(name) @@ -138,7 +138,7 @@ if modref and getattr(modref, head, None) == self: setattr(modref, head, mod) - object.__setattr__(self, "_module", mod) + object.__setattr__(self, r"_module", mod) def __repr__(self): if self._module: diff -r 6ceb3c4c3ab6 -r f80d9ddc40f3 mercurial/pure/osutil.py --- a/mercurial/pure/osutil.py Sun Mar 26 17:12:06 2017 +0900 +++ b/mercurial/pure/osutil.py Sun Mar 26 16:33:12 2017 +0900 @@ -342,8 +342,8 @@ # unfortunately, f.name is '' at this point -- so we store # the name on this wrapper. We cannot just assign to f.name, # because that attribute is read-only. - object.__setattr__(self, 'name', name) - object.__setattr__(self, '_file', f) + object.__setattr__(self, r'name', name) + object.__setattr__(self, r'_file', f) def __iter__(self): return self._file diff -r 6ceb3c4c3ab6 -r f80d9ddc40f3 mercurial/vfs.py --- a/mercurial/vfs.py Sun Mar 26 17:12:06 2017 +0900 +++ b/mercurial/vfs.py Sun Mar 26 16:33:12 2017 +0900 @@ -480,7 +480,7 @@ Do not instantiate outside of the vfs layer. """ def __init__(self, fh): - object.__setattr__(self, '_origfh', fh) + object.__setattr__(self, r'_origfh', fh) def __getattr__(self, attr): return getattr(self._origfh, attr) @@ -507,7 +507,7 @@ """ def __init__(self, fh, closer): super(delayclosedfile, self).__init__(fh) - object.__setattr__(self, '_closer', closer) + object.__setattr__(self, r'_closer', closer) def __exit__(self, exc_type, exc_value, exc_tb): self._closer.close(self._origfh) @@ -618,7 +618,7 @@ """ def __init__(self, fh): super(checkambigatclosing, self).__init__(fh) - object.__setattr__(self, '_oldstat', util.filestat(fh.name)) + object.__setattr__(self, r'_oldstat', util.filestat(fh.name)) def _checkambig(self): oldstat = self._oldstat diff -r 6ceb3c4c3ab6 -r f80d9ddc40f3 mercurial/windows.py --- a/mercurial/windows.py Sun Mar 26 17:12:06 2017 +0900 +++ b/mercurial/windows.py Sun Mar 26 16:33:12 2017 +0900 @@ -61,8 +61,8 @@ OPWRITE = 2 def __init__(self, fp): - object.__setattr__(self, '_fp', fp) - object.__setattr__(self, '_lastop', 0) + object.__setattr__(self, r'_fp', fp) + object.__setattr__(self, r'_lastop', 0) def __getattr__(self, name): return getattr(self._fp, name) @@ -74,42 +74,42 @@ self._fp.seek(0, os.SEEK_CUR) def seek(self, *args, **kwargs): - object.__setattr__(self, '_lastop', self.OPNONE) + object.__setattr__(self, r'_lastop', self.OPNONE) return self._fp.seek(*args, **kwargs) def write(self, d): if self._lastop == self.OPREAD: self._noopseek() - object.__setattr__(self, '_lastop', self.OPWRITE) + object.__setattr__(self, r'_lastop', self.OPWRITE) return self._fp.write(d) def writelines(self, *args, **kwargs): if self._lastop == self.OPREAD: self._noopeseek() - object.__setattr__(self, '_lastop', self.OPWRITE) + object.__setattr__(self, r'_lastop', self.OPWRITE) return self._fp.writelines(*args, **kwargs) def read(self, *args, **kwargs): if self._lastop == self.OPWRITE: self._noopseek() - object.__setattr__(self, '_lastop', self.OPREAD) + object.__setattr__(self, r'_lastop', self.OPREAD) return self._fp.read(*args, **kwargs) def readline(self, *args, **kwargs): if self._lastop == self.OPWRITE: self._noopseek() - object.__setattr__(self, '_lastop', self.OPREAD) + object.__setattr__(self, r'_lastop', self.OPREAD) return self._fp.readline(*args, **kwargs) def readlines(self, *args, **kwargs): if self._lastop == self.OPWRITE: self._noopseek() - object.__setattr__(self, '_lastop', self.OPREAD) + object.__setattr__(self, r'_lastop', self.OPREAD) return self._fp.readlines(*args, **kwargs) def posixfile(name, mode='r', buffering=-1):