You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
assignee=Noneclosed_at=<Date2017-04-21.23:46:00.386>created_at=<Date2016-09-09.09:24:54.047>labels= ['type-bug', 'invalid', 'OS-windows']
title='Inconsistent behavior: Get st_nlink from os.stat() and os.scandir()'updated_at=<Date2017-04-21.23:46:00.384>user='https://bugs.python.org/MohansonLeaf'
os.stat(file).st_nlink gives 1 but same file's st_nlink from os.scandir(dir) gives 0.
"""
Inconsistent behavior: Get st_nlink from os.stat() and os.scandir()
Platform: Python 3.5.1 (v3.5.1:37a07cee5969, Dec 6 2015, 01:38:48) [MSC v.1900 32 bit (Intel)] on win32
"""
This is documented behavior. Per the docs for os.DirEntry's stat method (the objects yielded by os.scandir):
On Windows, the st_ino, st_dev and st_nlink attributes of the stat_result are always set to zero. Call os.stat() to get these attributes.
It might be nice if those values could be cached on read (through a lazily initialized value on property access or the like), but this is not a bug, it's working as documented.
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: