This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: ctypes.WinError() confuses errno with winerror
Type: behavior Stage: resolved
Components: Versions: Python 3.3, Python 3.4
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: python-dev, sbt
Priority: normal Keywords:

Created on 2012-10-08 22:08 by sbt, last changed 2022-04-11 14:57 by admin. This issue is now closed.

Messages (2)
msg172419 - (view) Author: Richard Oudkerk (sbt) * (Python committer) Date: 2012-10-08 22:08
ctypes.WinError() is defined as

    def WinError(code=None, descr=None):
        if code is None:
            code = GetLastError()
        if descr is None:
            descr = FormatError(code).strip()
        return WindowsError(code, descr)

Since WindowsError became an alias for OSError, this means that if e is the exception raised, e.errno == GetLastError() and e.winerror == None.

I think the last line should be

        return WindowsError(None, descr, None, code)
msg172477 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2012-10-09 12:55
New changeset a3d65edc3b04 by Richard Oudkerk in branch '3.3':
Issue #16169: Fix ctypes.WinError()'s confusion between errno and winerror
http://hg.python.org/cpython/rev/a3d65edc3b04

New changeset d3c4dcd9a048 by Richard Oudkerk in branch 'default':
Issue #16169: Merge
http://hg.python.org/cpython/rev/d3c4dcd9a048
History
Date User Action Args
2022-04-11 14:57:37adminsetgithub: 60373
2012-10-09 14:09:59sbtsetstatus: open -> closed
resolution: fixed
stage: needs patch -> resolved
2012-10-09 12:55:27python-devsetnosy: + python-dev
messages: + msg172477
2012-10-08 22:08:17sbtcreate