This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author madison.may
Recipients jveldridge, madison.may
Date 2013-07-06.21:55:16
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1373147716.27.0.52227984431.issue18389@psf.upfronthosting.co.za>
In-reply-to
Content
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.
History
Date User Action Args
2013-07-06 21:55:16madison.maysetrecipients: + madison.may, jveldridge
2013-07-06 21:55:16madison.maysetmessageid: <1373147716.27.0.52227984431.issue18389@psf.upfronthosting.co.za>
2013-07-06 21:55:16madison.maylinkissue18389 messages
2013-07-06 21:55:16madison.maycreate