mirror of
				https://github.com/python/cpython.git
				synced 2025-10-30 21:21:22 +00:00 
			
		
		
		
	[3.9] bpo-40833: Clarify Path.rename doc-string regarding relative paths (GH-20554)
(cherry picked from commit f97e42ef4d)
Co-authored-by: Ram Rachum <ram@rachum.com>
			
			
This commit is contained in:
		
							parent
							
								
									a0f2b66433
								
							
						
					
					
						commit
						ef7b937b8f
					
				
					 2 changed files with 22 additions and 5 deletions
				
			
		|  | @ -1366,17 +1366,26 @@ def link_to(self, target): | |||
| 
 | ||||
|     def rename(self, target): | ||||
|         """ | ||||
|         Rename this path to the given path, | ||||
|         and return a new Path instance pointing to the given path. | ||||
|         Rename this path to the target path. | ||||
| 
 | ||||
|         The target path may be absolute or relative. Relative paths are | ||||
|         interpreted relative to the current working directory, *not* the | ||||
|         directory of the Path object. | ||||
| 
 | ||||
|         Returns the new Path instance pointing to the target path. | ||||
|         """ | ||||
|         self._accessor.rename(self, target) | ||||
|         return self.__class__(target) | ||||
| 
 | ||||
|     def replace(self, target): | ||||
|         """ | ||||
|         Rename this path to the given path, clobbering the existing | ||||
|         destination if it exists, and return a new Path instance | ||||
|         pointing to the given path. | ||||
|         Rename this path to the target path, overwriting if that path exists. | ||||
| 
 | ||||
|         The target path may be absolute or relative. Relative paths are | ||||
|         interpreted relative to the current working directory, *not* the | ||||
|         directory of the Path object. | ||||
| 
 | ||||
|         Returns the new Path instance pointing to the target path. | ||||
|         """ | ||||
|         self._accessor.replace(self, target) | ||||
|         return self.__class__(target) | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Miss Skeleton (bot)
						Miss Skeleton (bot)