File tree Expand file tree Collapse file tree 1 file changed +3
-31
lines changed Expand file tree Collapse file tree 1 file changed +3
-31
lines changed Original file line number Diff line number Diff line change @@ -407,9 +407,8 @@ def stub(*args, **kwds):
407407
408408
409409def  _setup ():
410-     # TODO: is the raw_input logic still required? 
411-     global  _old_raw_input 
412-     if  _old_raw_input  is  not   None :
410+     global  _setup_run 
411+     if  _setup_run :
413412        return 
414413    # don't run _setup twice 
415414
@@ -425,33 +424,6 @@ def _setup():
425424    _wrapper .f_out  =  f_out 
426425    _wrapper .setup_std_streams (sys .stdin , sys .stdout , sys .stderr )
427426
428-     if  "__pypy__"  in  sys .builtin_module_names :  # PyPy 
429427
430-         def  _old_raw_input (prompt = "" ):
431-             # sys.__raw_input__() is only called when stdin and stdout are 
432-             # as expected and are ttys.  If it is the case, then get_reader() 
433-             # should not really fail in _wrapper.raw_input().  If it still 
434-             # does, then we will just cancel the redirection and call again 
435-             # the built-in raw_input(). 
436-             with  contextlib .suppress (AttributeError ):
437-                 del  sys .__raw_input__ 
438-             return  input (prompt )
439- 
440-         sys .__raw_input__  =  _wrapper .raw_input 
441- 
442-     else :
443-         # this is not really what readline.c does.  Better than nothing I guess 
444-         try :
445-             import  builtins 
446- 
447-             _old_raw_input  =  builtins .raw_input 
448-             builtins .raw_input  =  _wrapper .raw_input 
449-         except  ImportError :
450-             import  builtins 
451- 
452-             _old_raw_input  =  builtins .input 
453-             builtins .input  =  _wrapper .raw_input 
454- 
455- 
456- _old_raw_input  =  None 
428+ _setup_run  =  False 
457429_setup ()
    
 
   
 
     
   
   
          
     
  
    
     
 
    
      
     
 
     
    You can’t perform that action at this time.
  
 
    
  
     
    
      
        
     
 
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments