Message192489
So the problem arises because a path to a file (not a path to a directory) is passed as an argument to start. So the way I see it, we could go one of several directions:
1) We could check for the presence of an extension in the start argument, and truncate start_path to start_path[:-1] if an extension is found. This wouldn't deal with the case where a path to a file without an extension is passed to relpath(), but it would deal with the large majority of cases. I'm in favor of this option.
2) We could add a warning to the docs and let users know that paths to files shouldn't be passed as the 'start' argument to relpath() -- only paths to directories are valid. You could perhaps even raise an error when a path to a file with an extension is passed as the 'start' argument.
I've attached a patch for posixpath.py and ntpath.py with the first option in mind. The patch also contains an test case for this behavior. |
|
Date |
User |
Action |
Args |
2013-07-06 21:55:16 | madison.may | set | recipients:
+ madison.may, jveldridge |
2013-07-06 21:55:16 | madison.may | set | messageid: <1373147716.27.0.52227984431.issue18389@psf.upfronthosting.co.za> |
2013-07-06 21:55:16 | madison.may | link | issue18389 messages |
2013-07-06 21:55:16 | madison.may | create | |
|