[New-bugs-announce] [issue28474] WinError(): Python int too large to convert to C long

Kelvin You report at bugs.python.org
Wed Oct 19 03:28:01 EDT 2016


New submission from Kelvin You:

// callproc.c
static PyObject *format_error(PyObject *self, PyObject *args)
{
    PyObject *result;
    wchar_t *lpMsgBuf;
    DWORD code = 0;
    if (!PyArg_ParseTuple(args, "|i:FormatError", &code))  
                                  ^ Here the format string should be "|I:FormatError"
        return NULL;
    if (code == 0)
        code = GetLastError();
    lpMsgBuf = FormatError(code);
    if (lpMsgBuf) {
        result = PyUnicode_FromWideChar(lpMsgBuf, wcslen(lpMsgBuf));
        LocalFree(lpMsgBuf);
    } else {
        result = PyUnicode_FromString("<no description>");
    }
    return result;
}

----------
components: ctypes
messages: 278963
nosy: Kelvin You
priority: normal
severity: normal
status: open
title: WinError(): Python int too large to convert to C long
type: crash
versions: Python 2.7, Python 3.3, Python 3.4, Python 3.5, Python 3.6

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


More information about the New-bugs-announce mailing list