[Python-Dev] [ 1669539 ] Change (fix!) os.path.isabs() semantics on Win32
Jason Orendorff
jason.orendorff at gmail.com
Wed Mar 7 12:52:25 CET 2007
On 3/7/07, "Martin v. Löwis" <martin at v.loewis.de> wrote:
> Terry Jones schrieb:
> > I do think the behavior can be improved, and that it should be fixed, but
> > at a place where other incompatible changes will also be being made,
>
> Indeed, 2.6 is such a place. Any feature release can contain
> incompatible behavior, and any feature release did contain incompatible
> behavior. Just look at the "porting to" sections of past whatsnew files.
While we're at it, patch 1669539 makes a similar incompatible change
to ntpath.isabs(). On Windows there are:
- true relative paths, like Lib\ntpath.py
- true absolute paths, like C:\Python25 and \\server\share
- oddities, like C:ntpath.py and \Python25
isabs() is inconsistent about oddities:
>>> ntpath.isabs(r'C:ntpath.py')
False
>>> ntpath.isabs(r'\Python25')
True
I don't think there's any logic behind this behavior. The current
documentation for isabs() is:
isabs(path)
Return True if path is an absolute pathname (begins with a slash).
The patch makes isabs(oddity) return False.
I don't think existing code is a huge concern here. Google Code
Search suggests that no one thinks about the oddities. Most existing
code using isabs() has acceptable-but-slightly-odd behavior for
oddities, and that kind of code would have different
acceptable-but-slightly-odd behavior under the proposed change. And
oddities are rare.
The patch is incomplete (no docs) but ripe for a note of encouragement
(or summary rejection) from a committer.
-j
More information about the Python-Dev
mailing list