Fix raw_input which is not converted by 2to3 if not called.

This commit is contained in:
Georg Brandl
2010-07-28 20:24:35 +02:00
parent 829a05e1dd
commit 67ffb9bf54
2 changed files with 12 additions and 3 deletions

View File

@@ -22,7 +22,11 @@ from sphinx.util.console import purple, bold, red, turquoise, \
from sphinx.util import texescape
# function to get input from terminal -- overridden by the test suite
term_input = raw_input
try:
# this raw_input is not converted by 2to3
term_input = raw_input
except NameError:
term_input = input
PROMPT_PREFIX = '> '
@@ -692,7 +696,7 @@ if sys.version_info >= (3, 0):
return _unicode_string_re.sub('\\1', source)
for f in ['QUICKSTART_CONF', 'EPUB_CONFIG', 'INTERSPHINX_CONFIG']:
globals()[f] = convert_python_source(globals()[f])
globals()[f] = _convert_python_source(globals()[f])
del _unicode_string_re, _convert_python_source

View File

@@ -36,8 +36,13 @@ def mock_raw_input(answers, needanswer=False):
return ''
return raw_input
try:
real_raw_input = raw_input
except NameError:
real_raw_input = input
def teardown_module():
qs.term_input = raw_input
qs.term_input = real_raw_input
qs.TERM_ENCODING = getattr(sys.stdin, 'encoding', None)
coloron()