[New-bugs-announce] [issue28041] Inconsistent behavior: Get st_nlink from os.stat() and os.scandir()
Mohanson Leaf
report at bugs.python.org
Fri Sep 9 05:24:54 EDT 2016
New submission from Mohanson Leaf:
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
"""
import os
import os.path
print('os.stat:', os.stat(__file__).st_nlink)
for entry in os.scandir(os.path.dirname(os.path.abspath(__file__))):
if entry.name == 'stat.py':
print('os.scandir:', entry.stat().st_nlink)
"""
os.stat: 1
os.scandir: 0
"""
----------
components: Windows
files: stat.py
messages: 275293
nosy: Mohanson Leaf, paul.moore, steve.dower, tim.golden, zach.ware
priority: normal
severity: normal
status: open
title: Inconsistent behavior: Get st_nlink from os.stat() and os.scandir()
type: behavior
versions: Python 3.5
Added file: http://bugs.python.org/file44494/stat.py
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue28041>
_______________________________________
More information about the New-bugs-announce
mailing list