Message299266
The generic abspath implementation could be moved into the genericpath module, where it will be common to both posixpath and ntpath: def abspath(path): """Return an absolute path.""" path = os.fspath(path) if not isabs(path): if isinstance(path, bytes): cwd = os.getcwdb() else: cwd = os.getcwd() path = join(cwd, path) return normpath(path) Then replace it in ntpath if nt._getfullpathname is defined, but with a fallback to the generic implementation if OSError is raised (e.g. for " "): try: from nt import _getfullpathname except ImportError: pass else: def abspath(path): """Return an absolute path.""" try: return _getfullpathname(path) except OSError: return genericpath.abspath(path) This _getfullpathname version also skips the redundant fspath and normpath calls. | |
| Date | User | Action | Args | | 2017-07-26 21:48:00 | eryksun | set | recipients: + eryksun, paul.moore, tim.golden, zach.ware, steve.dower, lazka | | 2017-07-26 21:48:00 | eryksun | set | messageid: <1501105680.02.0.216302914016.issue31047@psf.upfronthosting.co.za> | | 2017-07-26 21:47:59 | eryksun | link | issue31047 messages | | 2017-07-26 21:47:59 | eryksun | create | | |