equal
deleted
inserted
replaced
216 _kernel32.CreateFileA.restype = _HANDLE |
216 _kernel32.CreateFileA.restype = _HANDLE |
217 |
217 |
218 def _raiseioerror(name): |
218 def _raiseioerror(name): |
219 err = ctypes.WinError() |
219 err = ctypes.WinError() |
220 raise IOError( |
220 raise IOError( |
221 err.errno, r'%s: %s' % (encoding.strfromlocal(name), err.strerror) |
221 err.errno, '%s: %s' % (encoding.strfromlocal(name), err.strerror) |
222 ) |
222 ) |
223 |
223 |
224 class posixfile(object): |
224 class posixfile(object): |
225 '''a file object aiming for POSIX-like semantics |
225 '''a file object aiming for POSIX-like semantics |
226 |
226 |
278 |
278 |
279 f = os.fdopen(fd, pycompat.sysstr(mode), bufsize) |
279 f = os.fdopen(fd, pycompat.sysstr(mode), bufsize) |
280 # unfortunately, f.name is '<fdopen>' at this point -- so we store |
280 # unfortunately, f.name is '<fdopen>' at this point -- so we store |
281 # the name on this wrapper. We cannot just assign to f.name, |
281 # the name on this wrapper. We cannot just assign to f.name, |
282 # because that attribute is read-only. |
282 # because that attribute is read-only. |
283 object.__setattr__(self, r'name', name) |
283 object.__setattr__(self, 'name', name) |
284 object.__setattr__(self, r'_file', f) |
284 object.__setattr__(self, '_file', f) |
285 |
285 |
286 def __iter__(self): |
286 def __iter__(self): |
287 return self._file |
287 return self._file |
288 |
288 |
289 def __getattr__(self, name): |
289 def __getattr__(self, name): |