File tree Expand file tree Collapse file tree 1 file changed +14
-2
lines changed Expand file tree Collapse file tree 1 file changed +14
-2
lines changed Original file line number Diff line number Diff line change @@ -395,9 +395,21 @@ def _setup():
395
395
_wrapper .f_in = f_in
396
396
_wrapper .f_out = f_out
397
397
398
- if hasattr (sys , '__raw_input__' ): # PyPy
399
- _old_raw_input = sys .__raw_input__
398
+ if '__pypy__' in sys .builtin_module_names : # PyPy
399
+
400
+ def _old_raw_input (prompt = '' ):
401
+ # sys.__raw_input__() is only called when stdin and stdout are
402
+ # as expected and are ttys. If it is the case, then get_reader()
403
+ # should not really fail in _wrapper.raw_input(). If it still
404
+ # does, then we will just cancel the redirection and call again
405
+ # the built-in raw_input().
406
+ try :
407
+ del sys .__raw_input__
408
+ except AttributeError :
409
+ pass
410
+ return raw_input (prompt )
400
411
sys .__raw_input__ = _wrapper .raw_input
412
+
401
413
else :
402
414
# this is not really what readline.c does. Better than nothing I guess
403
415
import __builtin__
You can’t perform that action at this time.
0 commit comments