classification
Title: Opening CON for write access fails
Type: behavior Stage: resolved
Components: IO, Library (Lib), Windows Versions: Python 3.7, Python 3.6
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: eryksun, paul.moore, python-dev, steve.dower, tim.golden, zach.ware
Priority: normal Keywords:

Created on 2016-09-15 03:24 by eryksun, last changed 2017-03-31 16:36 by dstufft. This issue is now closed.

Pull Requests
URL Status Linked Edit
PR 552 closed dstufft, 2017-03-31 16:36
Messages (2)
msg276507 - (view) Author: Eryk Sun (eryksun) * (Python triager) Date: 2016-09-15 03:24
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.
msg276847 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2016-09-17 20:51
New changeset d0bab9fda568 by Steve Dower in branch '3.6':
Issue #28161: Opening CON for write access fails
https://hg.python.org/cpython/rev/d0bab9fda568

New changeset 187a114b9ef4 by Steve Dower in branch 'default':
Issue #28161: Opening CON for write access fails
https://hg.python.org/cpython/rev/187a114b9ef4
History
Date User Action Args
2017-03-31 16:36:19dstufftsetpull_requests: + pull_request936
2016-09-17 20:52:19steve.dowersetstatus: open -> closed
resolution: fixed
stage: test needed -> resolved
2016-09-17 20:51:45python-devsetnosy: + python-dev
messages: + msg276847
2016-09-15 03:24:24eryksuncreate