def from_subprocess(cls, arg): arg = int(arg) if MS_WINDOWS: fd = msvcrt.open_osfhandle(arg, os.O_WRONLY) else: fd = arg return cls(fd)