mirror of
				https://github.com/python/cpython.git
				synced 2025-10-30 21:21:22 +00:00 
			
		
		
		
	bpo-23082: Better error message for PurePath.relative_to() from pathlib (GH-19611)
Co-authored-by: Sadhana Srinivasan <rotuna@Sadhanas-MBP.fritz.box>
(cherry picked from commit 448325369f)
Co-authored-by: Rotuna <sadhanasrinivasan@protonmail.com>
			
			
This commit is contained in:
		
							parent
							
								
									31084be618
								
							
						
					
					
						commit
						318a18eb88
					
				
					 3 changed files with 6 additions and 2 deletions
				
			
		|  | @ -922,7 +922,8 @@ def relative_to(self, *other): | |||
|         cf = self._flavour.casefold_parts | ||||
|         if (root or drv) if n == 0 else cf(abs_parts[:n]) != cf(to_abs_parts): | ||||
|             formatted = self._format_parsed_parts(to_drv, to_root, to_parts) | ||||
|             raise ValueError("{!r} does not start with {!r}" | ||||
|             raise ValueError("{!r} is not in the subpath of {!r}" | ||||
|                     " OR one path is relative and the other is absolute." | ||||
|                              .format(str(self), str(formatted))) | ||||
|         return self._from_parsed_parts('', root if n == 1 else '', | ||||
|                                        abs_parts[n:]) | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Miss Islington (bot)
						Miss Islington (bot)