[New-bugs-announce] [issue37074] os.stat() does not work for NUL and CON

Serhiy Storchaka report at bugs.python.org
Tue May 28 03:37:41 EDT 2019


New submission from Serhiy Storchaka <storchaka+cpython at gmail.com>:

>>> os.stat('nul')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
OSError: [WinError 1] Incorrect function: 'nul'
>>> os.stat('con')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
OSError: [WinError 87] The parameter is incorrect: 'con'

But os.open() and os.fstat() work.

>>> os.fstat(os.open('nul', os.O_RDONLY))
os.stat_result(st_mode=8192, st_ino=0, st_dev=0, st_nlink=0, st_uid=0, st_gid=0, st_size=0, st_atime=0, st_mtime=0, st_ctime=0)
>>> os.fstat(os.open('con', os.O_RDONLY))
os.stat_result(st_mode=8192, st_ino=0, st_dev=0, st_nlink=0, st_uid=0, st_gid=0, st_size=0, st_atime=0, st_mtime=0, st_ctime=0)

----------
components: Windows
messages: 343745
nosy: paul.moore, serhiy.storchaka, steve.dower, tim.golden, zach.ware
priority: normal
severity: normal
status: open
title: os.stat() does not work for NUL and CON
type: behavior
versions: Python 2.7, Python 3.7, Python 3.8

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue37074>
_______________________________________


More information about the New-bugs-announce mailing list