This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author eryksun
Recipients cheryl.sabella, docs@python, eryksun, giampaolo.rodola, paul.moore, steve.dower, tim.golden, vstinner, zach.ware
Date 2018-01-15.01:27:26
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
This is the high-level shutil module, so why not try to use the resolved parent directory? For example:

    def disk_usage(path):
            total, free = nt._getdiskusage(path)
        except NotADirectoryError:
            path = os.path.dirname(nt._getfinalpathname(path))
            total, free = nt._getdiskusage(path)
        used = total - free
        return _ntuple_diskusage(total, used, free)

Also, as noted in msg260022, nt._getdiskusage was overlooked when implementing PEP 529. The same applies to nt._getfinalpathname and nt._getvolumepathname. nt._getfullpathname works with bytes because it takes an argument-clinic `path_t` instead of `unicode` or `Py_UNICODE`. I think the other 3 should be rewritten to use path_t, but it's out of scope for this issue.
Date User Action Args
2018-01-15 01:27:27eryksunsetrecipients: + eryksun, paul.moore, vstinner, giampaolo.rodola, tim.golden, docs@python, zach.ware, steve.dower, cheryl.sabella
2018-01-15 01:27:27eryksunsetmessageid: <>
2018-01-15 01:27:27eryksunlinkissue26330 messages
2018-01-15 01:27:26eryksuncreate