mirror of
				https://github.com/python/cpython.git
				synced 2025-10-30 21:21:22 +00:00 
			
		
		
		
	GH-125413: pathlib ABCs: use caching path.info.exists() when globbing (#130422)
				
					
				
			Call `ReadablePath.info.exists()` rather than `ReadablePath.exists()` when globbing so that we use (or populate) the `info` cache.
This commit is contained in:
		
							parent
							
								
									d73d69e232
								
							
						
					
					
						commit
						48c84a400a
					
				
					 3 changed files with 9 additions and 10 deletions
				
			
		|  | @ -316,14 +316,11 @@ def walk(self, top_down=True, on_error=None, follow_symlinks=False): | |||
|                 paths.append((path, dirnames, filenames)) | ||||
|             try: | ||||
|                 for child in path.iterdir(): | ||||
|                     try: | ||||
|                         if child.info.is_dir(follow_symlinks=follow_symlinks): | ||||
|                             if not top_down: | ||||
|                                 paths.append(child) | ||||
|                             dirnames.append(child.name) | ||||
|                         else: | ||||
|                             filenames.append(child.name) | ||||
|                     except OSError: | ||||
|                     if child.info.is_dir(follow_symlinks=follow_symlinks): | ||||
|                         if not top_down: | ||||
|                             paths.append(child) | ||||
|                         dirnames.append(child.name) | ||||
|                     else: | ||||
|                         filenames.append(child.name) | ||||
|             except OSError as error: | ||||
|                 if on_error is not None: | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Barney Gale
						Barney Gale