equal
deleted
inserted
replaced
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) |