A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from http://mail.python.org/pipermail/python-dev/2000-August/008385.html below:

[Python-Dev] os.path.commonprefix breakage

[Python-Dev] os.path.commonprefix breakageMark Hammond MarkH@ActiveState.com
Thu, 17 Aug 2000 13:32:25 +1000
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.





RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4