File tree Expand file tree Collapse file tree 1 file changed +7
-7
lines changed
Expand file tree Collapse file tree 1 file changed +7
-7
lines changed Original file line number Diff line number Diff line change @@ -580,21 +580,21 @@ def abspath(path):
580580 pass
581581 path = os .fspath (path )
582582 if not isabs (path ):
583- if isinstance (path , bytes ):
583+ if is_bytes := isinstance (path , bytes ):
584584 sep = b'\\ '
585- cwd = os .getcwdb ()
586585 else :
587586 sep = '\\ '
588- cwd = os .getcwd ()
589587 drive , root , path = splitroot (path )
590- if drive and drive != splitroot (cwd )[0 ]:
588+ # Either drive or root can be nonempty, but not both.
589+ if drive or root :
591590 try :
592- path = join (_getfullpathname (drive ), path )
591+ path = join (_getfullpathname (drive + root ), path )
593592 except (OSError , ValueError ):
594- # Invalid drive \x00: on Windows; assume root directory
593+ # Drive "\0:" cannot exist; use the root directory.
595594 path = drive + sep + path
596595 else :
597- path = join (cwd , root + path )
596+ cwd = os .getcwdb () if is_bytes else os .getcwd ()
597+ path = join (cwd , path )
598598 return normpath (path )
599599
600600try :
You can’t perform that action at this time.
0 commit comments