equal
deleted
inserted
replaced
535 readline.read_history_file |
535 readline.read_history_file |
536 # windows sometimes raises something other than ImportError |
536 # windows sometimes raises something other than ImportError |
537 except Exception: |
537 except Exception: |
538 pass |
538 pass |
539 |
539 |
540 # instead of trying to emulate raw_input, swap our in/out |
540 # call write() so output goes through subclassed implementation |
541 # with sys.stdin/out |
541 # e.g. color extension on Windows |
542 old = sys.stdout, sys.stdin |
542 self.write(prompt) |
543 sys.stdout, sys.stdin = self.fout, self.fin |
543 |
544 line = raw_input(prompt) |
544 # instead of trying to emulate raw_input, swap self.fin with sys.stdin |
545 sys.stdout, sys.stdin = old |
545 old = sys.stdin |
|
546 sys.stdin = self.fin |
|
547 line = raw_input() |
|
548 sys.stdin = old |
546 |
549 |
547 # When stdin is in binary mode on Windows, it can cause |
550 # When stdin is in binary mode on Windows, it can cause |
548 # raw_input() to emit an extra trailing carriage return |
551 # raw_input() to emit an extra trailing carriage return |
549 if os.linesep == '\r\n' and line and line[-1] == '\r': |
552 if os.linesep == '\r\n' and line and line[-1] == '\r': |
550 line = line[:-1] |
553 line = line[:-1] |