]> granicus.if.org Git - python/commitdiff
SF bug #574235, convert_path fails with empty pathname
authorNeal Norwitz <nnorwitz@gmail.com>
Tue, 13 Aug 2002 17:42:57 +0000 (17:42 +0000)
committerNeal Norwitz <nnorwitz@gmail.com>
Tue, 13 Aug 2002 17:42:57 +0000 (17:42 +0000)
Lib/distutils/util.py

index d9c622487ce4d8af86520d9eb5e8cae57e5e738f..8d22415496fa2491c8c3bf6096785a8c38b02bbd 100644 (file)
@@ -84,9 +84,11 @@ def convert_path (pathname):
     """
     if os.sep == '/':
         return pathname
-    if pathname and pathname[0] == '/':
+    if not pathname:
+        return pathname
+    if pathname[0] == '/':
         raise ValueError, "path '%s' cannot be absolute" % pathname
-    if pathname and pathname[-1] == '/':
+    if pathname[-1] == '/':
         raise ValueError, "path '%s' cannot end with '/'" % pathname
 
     paths = string.split(pathname, '/')