[issue28161] Opening CON for write access fails

Eryk Sun report at bugs.python.org
Wed Sep 14 23:24:25 EDT 2016


New submission from Eryk Sun:

When opening the CON device the underlying CreateFile call needs to use either GENERIC_READ or GENERIC_WRITE access, but not both. Currently opening for writing fails as follows:

   >>> open('CON', 'wb', buffering=0)
   Traceback (most recent call last):
      File "<stdin>", line 1, in <module>
   OSError: [WinError 87] The parameter is incorrect: 'CON'

If self->writable is true, it should set `access = GENERIC_WRITE`, not `access |= GENERIC_WRITE`.

This only applies to CON. It's normal to open CONIN$ and CONOUT$ with both read and write access, and WindowsConsoleIO handles that correctly.

----------
components: IO, Library (Lib), Windows
messages: 276507
nosy: eryksun, paul.moore, steve.dower, tim.golden, zach.ware
priority: normal
severity: normal
stage: test needed
status: open
title: Opening CON for write access fails
type: behavior
versions: Python 3.6, Python 3.7

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue28161>
_______________________________________


More information about the Python-bugs-list mailing list