[Python-Dev] os.path.commonprefix breakage (original) (raw)
Mark Hammond MarkH@ActiveState.com
Thu, 17 Aug 2000 13:32:25 +1000
- Previous message: [Python-Dev] [Fwd: segfault in sre on 64-bit plats]
- Next message: [Python-Dev] os.path.commonprefix breakage
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Hi, I believe that Skip recently made a patch to os.path.commonprefix to only return the portion of the common prefix that corresponds to a directory.
I have just dicovered some code breakage from this change. On 1.5.2, the behaviour was:
os.path.commonprefix(["../foo/bar", "../foo/spam"]) '../foo/'
While since the change we have: '../foo'
Note that the trailing slash has been dropped.
The code this broke did similar to:
prefix = os.path.commonprefix(files) for file in files: tail_portion = file[len(prefix):]
In 1.6, the "tail_portion" result looks like an absolute path "/bar" and "/spam", respectively. The intent was obviously to get absolute path names back ("bar" and "spam")
The code that broke is not mine, so you can safely be horrified at how broken it is :-) The point, however, is that code like this does exist out there.
I'm obviously going to change the code that broke, and don't have time to look into the posixpath.py code - but is this level of possible breakage acceptable?
Thanks,
Mark.
- Previous message: [Python-Dev] [Fwd: segfault in sre on 64-bit plats]
- Next message: [Python-Dev] os.path.commonprefix breakage
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]