comparison mercurial/pure/osutil.py @ 30925:82f1ef8b4477

py3: convert the mode argument of os.fdopen to unicodes (2 of 2)
author Pulkit Goyal <7895pulkit@gmail.com>
date Mon, 13 Feb 2017 22:15:28 +0530
parents e995f00a9e9a
children f80d9ddc40f3
comparison
equal deleted inserted replaced
30924:48dea083f66d 30925:82f1ef8b4477
336 fd = msvcrt.open_osfhandle(fh, flags) 336 fd = msvcrt.open_osfhandle(fh, flags)
337 if fd == -1: 337 if fd == -1:
338 _kernel32.CloseHandle(fh) 338 _kernel32.CloseHandle(fh)
339 _raiseioerror(name) 339 _raiseioerror(name)
340 340
341 f = os.fdopen(fd, 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, 'name', name)
346 object.__setattr__(self, '_file', f) 346 object.__setattr__(self, '_file', f)