diff options
Diffstat (limited to 'Lib/macpath.py')
-rw-r--r-- | Lib/macpath.py | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/Lib/macpath.py b/Lib/macpath.py index c023646..3b3e4ff 100644 --- a/Lib/macpath.py +++ b/Lib/macpath.py @@ -172,7 +172,11 @@ def normpath(s): def abspath(path): """Return an absolute path.""" if not isabs(path): - path = join(os.getcwd(), path) + if isinstance(path, bytes): + cwd = os.getcwdb() + else: + cwd = os.getcwd() + path = join(cwd, path) return normpath(path) # realpath is a no-op on systems without islink support @@ -189,7 +193,10 @@ def realpath(path): path = components[0] + colon for c in components[1:]: path = join(path, c) - path = Carbon.File.FSResolveAliasFile(path, 1)[0].as_pathname() + try: + path = Carbon.File.FSResolveAliasFile(path, 1)[0].as_pathname() + except Carbon.File.Error: + pass return path supports_unicode_filenames = False |