File tree Expand file tree Collapse file tree 3 files changed +5
-4
lines changed Expand file tree Collapse file tree 3 files changed +5
-4
lines changed Original file line number Diff line number Diff line change @@ -319,12 +319,12 @@ def join(split_command):
319319
320320def  quote (s ):
321321    """Return a shell-escaped version of the string *s*.""" 
322-     if  not  isinstance (s , str ):
323-         raise  TypeError (f"expected string object, got { type (s ).__name__ !r}  " )
324- 
325322    if  not  s :
326323        return  "''" 
327324
325+     if  not  isinstance (s , str ):
326+         raise  TypeError (f"expected string object, got { type (s ).__name__ !r}  " )
327+ 
328328    # Use bytes.translate() for performance 
329329    safe_chars  =  (b'%+,-./0123456789:=@' 
330330                  b'ABCDEFGHIJKLMNOPQRSTUVWXYZ_' 
Original file line number Diff line number Diff line change @@ -330,6 +330,7 @@ def testQuote(self):
330330        unsafe  =  '"`$\\ !'  +  unicode_sample 
331331
332332        self .assertEqual (shlex .quote ('' ), "''" )
333+         self .assertEqual (shlex .quote (None ), "''" )
333334        self .assertEqual (shlex .quote (safeunquoted ), safeunquoted )
334335        self .assertEqual (shlex .quote ('test file name' ), "'test file name'" )
335336        for  u  in  unsafe :
Original file line number Diff line number Diff line change 11Raise :exc: `TypeError ` instead of :exc: `AttributeError ` when an argument of
22incorrect type is passed to :func: `shlex.quote `. This restores the behavior of
3- that  function pre- 3.14.
3+ the  function prior to  3.14.
    
 
   
 
     
   
   
          
     
  
    
     
 
    
      
     
 
     
    You can’t perform that action at this time.
  
 
    
  
     
    
      
        
     
 
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments