mirror of
				https://github.com/python/cpython.git
				synced 2025-11-04 07:31:38 +00:00 
			
		
		
		
	Issue #23742: ntpath.expandvars() no longer loses unbalanced single quotes.
This commit is contained in:
		
							parent
							
								
									81f241ab2e
								
							
						
					
					
						commit
						1b87ae0c91
					
				
					 3 changed files with 4 additions and 1 deletions
				
			
		| 
						 | 
					@ -400,7 +400,7 @@ def expandvars(path):
 | 
				
			||||||
                index = path.index(c)
 | 
					                index = path.index(c)
 | 
				
			||||||
                res += c + path[:index + 1]
 | 
					                res += c + path[:index + 1]
 | 
				
			||||||
            except ValueError:
 | 
					            except ValueError:
 | 
				
			||||||
                res += path
 | 
					                res += c + path
 | 
				
			||||||
                index = pathlen - 1
 | 
					                index = pathlen - 1
 | 
				
			||||||
        elif c == percent:  # variable or '%'
 | 
					        elif c == percent:  # variable or '%'
 | 
				
			||||||
            if path[index + 1:index + 2] == percent:
 | 
					            if path[index + 1:index + 2] == percent:
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -237,6 +237,7 @@ def test_expandvars(self):
 | 
				
			||||||
            tester('ntpath.expandvars("%?bar%")', "%?bar%")
 | 
					            tester('ntpath.expandvars("%?bar%")', "%?bar%")
 | 
				
			||||||
            tester('ntpath.expandvars("%foo%%bar")', "bar%bar")
 | 
					            tester('ntpath.expandvars("%foo%%bar")', "bar%bar")
 | 
				
			||||||
            tester('ntpath.expandvars("\'%foo%\'%bar")', "\'%foo%\'%bar")
 | 
					            tester('ntpath.expandvars("\'%foo%\'%bar")', "\'%foo%\'%bar")
 | 
				
			||||||
 | 
					            tester('ntpath.expandvars("bar\'%foo%")', "bar\'%foo%")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    @unittest.skipUnless(support.FS_NONASCII, 'need support.FS_NONASCII')
 | 
					    @unittest.skipUnless(support.FS_NONASCII, 'need support.FS_NONASCII')
 | 
				
			||||||
    def test_expandvars_nonascii(self):
 | 
					    def test_expandvars_nonascii(self):
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -18,6 +18,8 @@ Core and Builtins
 | 
				
			||||||
Library
 | 
					Library
 | 
				
			||||||
-------
 | 
					-------
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					- Issue #23742: ntpath.expandvars() no longer loses unbalanced single quotes.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
- Issue #21802: The reader in BufferedRWPair now is closed even when closing
 | 
					- Issue #21802: The reader in BufferedRWPair now is closed even when closing
 | 
				
			||||||
  writer failed in BufferedRWPair.close().
 | 
					  writer failed in BufferedRWPair.close().
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue