Message309941
This is the high-level shutil module, so why not try to use the resolved parent directory? For example:
def disk_usage(path):
try:
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:27 | eryksun | set | recipients:
+ eryksun, paul.moore, vstinner, giampaolo.rodola, tim.golden, docs@python, zach.ware, steve.dower, cheryl.sabella |
2018-01-15 01:27:27 | eryksun | set | messageid: <1515979647.28.0.467229070634.issue26330@psf.upfronthosting.co.za> |
2018-01-15 01:27:27 | eryksun | link | issue26330 messages |
2018-01-15 01:27:26 | eryksun | create | |
|