[issue28474] WinError(): Python int too large to convert to C long
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(""); } 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 <http://bugs.python.org/issue28474> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue28474] WinError(): Python int too large to convert to C long
Kelvin You added the comment: I report this issue because the function WlanScan(https://msdn.microsoft.com/zh-cn/library/windows/desktop/ms706783(v=vs.85).aspx) returns a error code 0x80342002 when the WLAN is disabled on Windows 10. ctypes.WinError() raise an exception of 'Python int too large to convert to C long' when handle this error code. -- ___ Python tracker <http://bugs.python.org/issue28474> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue28474] WinError(): Python int too large to convert to C long
Kelvin You added the comment: Here is the full list of windows error code: https://msdn.microsoft.com/en-us/library/cc231196.aspx You can see a lot of error codes is above 0x8000. -- ___ Python tracker <http://bugs.python.org/issue28474> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com