[New-bugs-announce] [issue16169] ctypes.WinError() confuses errno with winerror

Richard Oudkerk report at bugs.python.org
Tue Oct 9 00:08:17 CEST 2012


New submission from Richard Oudkerk:

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)

----------
messages: 172419
nosy: sbt
priority: normal
severity: normal
stage: needs patch
status: open
title: ctypes.WinError() confuses errno with winerror
type: behavior
versions: Python 3.3, Python 3.4

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


More information about the New-bugs-announce mailing list