def __init__(self, space): from pypy.module._file.interp_file import W_File self.space = space w_stdin = W_File(space) w_stdin.file_fdopen(0, "r", 1) w_stdin.w_name = space.newtext('<stdin>') self.w_stdin = w_stdin w_stdout = W_File(space) w_stdout.file_fdopen(1, "w", 1) w_stdout.w_name = space.newtext('<stdout>') self.w_stdout = w_stdout w_stderr = W_File(space) w_stderr.file_fdopen(2, "w", 0) w_stderr.w_name = space.newtext('<stderr>') self.w_stderr = w_stderr w_stdin._when_reading_first_flush(w_stdout)
def __init__(self, space): from pypy.module._file.interp_file import W_File self.space = space stdin = W_File(space) stdin.file_fdopen(0, "r", 1) stdin.w_name = space.wrap('<stdin>') self.w_stdin = space.wrap(stdin) stdout = W_File(space) stdout.file_fdopen(1, "w", 1) stdout.w_name = space.wrap('<stdout>') self.w_stdout = space.wrap(stdout) stderr = W_File(space) stderr.file_fdopen(2, "w", 0) stderr.w_name = space.wrap('<stderr>') self.w_stderr = space.wrap(stderr) stdin._when_reading_first_flush(stdout)