comparison mercurial/pure/osutil.py @ 31644:f80d9ddc40f3

py3: abuse r'' to preserve str-ness of literals passed to __setattr__()
author Yuya Nishihara <yuya@tcha.org>
date Sun, 26 Mar 2017 16:33:12 +0900
parents 82f1ef8b4477
children a9c71d578a1c
comparison
equal deleted inserted replaced
31643:6ceb3c4c3ab6 31644:f80d9ddc40f3
340 340
341 f = os.fdopen(fd, pycompat.sysstr(mode), bufsize) 341 f = os.fdopen(fd, pycompat.sysstr(mode), bufsize)
342 # unfortunately, f.name is '<fdopen>' at this point -- so we store 342 # unfortunately, f.name is '<fdopen>' at this point -- so we store
343 # the name on this wrapper. We cannot just assign to f.name, 343 # the name on this wrapper. We cannot just assign to f.name,
344 # because that attribute is read-only. 344 # because that attribute is read-only.
345 object.__setattr__(self, 'name', name) 345 object.__setattr__(self, r'name', name)
346 object.__setattr__(self, '_file', f) 346 object.__setattr__(self, r'_file', f)
347 347
348 def __iter__(self): 348 def __iter__(self):
349 return self._file 349 return self._file
350 350
351 def __getattr__(self, name): 351 def __getattr__(self, name):