mirror of
				https://github.com/python/cpython.git
				synced 2025-10-31 05:31:20 +00:00 
			
		
		
		
	GH-44626, GH-105476: Fix ntpath.isabs() handling of part-absolute paths (#113829)
				
					
				
			On Windows, `os.path.isabs()` now returns `False` when given a path that starts with exactly one (back)slash. This is more compatible with other functions in `os.path`, and with Microsoft's own documentation. Also adjust `pathlib.PureWindowsPath.is_absolute()` to call `ntpath.isabs()`, which corrects its handling of partial UNC/device paths like `//foo`. Co-authored-by: Jon Foster <jon@jon-foster.co.uk>
This commit is contained in:
		
							parent
							
								
									dac1da2121
								
							
						
					
					
						commit
						e4ff131e01
					
				
					 9 changed files with 51 additions and 33 deletions
				
			
		|  | @ -459,8 +459,8 @@ def _join(name): | |||
| 
 | ||||
|     def testParseArgsAbsolutePathsThatCannotBeConverted(self): | ||||
|         program = self.program | ||||
|         # even on Windows '/...' is considered absolute by os.path.abspath | ||||
|         argv = ['progname', '/foo/bar/baz.py', '/green/red.py'] | ||||
|         drive = os.path.splitdrive(os.getcwd())[0] | ||||
|         argv = ['progname', f'{drive}/foo/bar/baz.py', f'{drive}/green/red.py'] | ||||
|         self._patch_isfile(argv) | ||||
| 
 | ||||
|         program.createTests = lambda: None | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Barney Gale
						Barney Gale