X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/57ffa5851d26ec3b2aa16b6f3d6713fbeb8b897b..1d1972fce1db0ae559433967255ce486b0d7494a:/wxPython/src/helpers.cpp diff --git a/wxPython/src/helpers.cpp b/wxPython/src/helpers.cpp index 572ada736f..d4c30cce5f 100644 --- a/wxPython/src/helpers.cpp +++ b/wxPython/src/helpers.cpp @@ -191,21 +191,23 @@ void wxPyApp::ExitMainLoop() { #ifdef __WXDEBUG__ -void wxPyApp::OnAssert(const wxChar *file, - int line, - const wxChar *cond, - const wxChar *msg) { - +void wxPyApp::OnAssertFailure(const wxChar *file, + int line, + const wxChar *func, + const wxChar *cond, + const wxChar *msg) +{ // if we're not fully initialized then just log the error if (! m_startupComplete) { wxString buf; buf.Alloc(4096); buf.Printf(wxT("%s(%d): assert \"%s\" failed"), file, line, cond); - if (msg != NULL) { - buf += wxT(": "); - buf += msg; - } + if ( func && *func ) + buf << wxT(" in ") << func << wxT("()"); + if (msg != NULL) + buf << wxT(": ") << msg; + wxLogDebug(buf); return; } @@ -239,11 +241,12 @@ void wxPyApp::OnAssert(const wxChar *file, if (m_assertMode & wxPYAPP_ASSERT_EXCEPTION) { wxString buf; buf.Alloc(4096); - buf.Printf(wxT("C++ assertion \"%s\" failed in %s(%d)"), cond, file, line); - if (msg != NULL) { - buf += wxT(": "); - buf += msg; - } + buf.Printf(wxT("C++ assertion \"%s\" failed at %s(%d)"), cond, file, line); + if ( func && *func ) + buf << wxT(" in ") << func << wxT("()"); + if (msg != NULL) + buf << wxT(": ") << msg; + // set the exception wxPyBlock_t blocked = wxPyBeginBlockThreads(); @@ -264,16 +267,16 @@ void wxPyApp::OnAssert(const wxChar *file, buf.Alloc(4096); buf.Printf(wxT("%s(%d): assert \"%s\" failed"), file, line, cond); - if (msg != NULL) { - buf += wxT(": "); - buf += msg; - } + if ( func && *func ) + buf << wxT(" in ") << func << wxT("()"); + if (msg != NULL) + buf << wxT(": ") << msg; wxLogDebug(buf); } // do the normal wx assert dialog? if (m_assertMode & wxPYAPP_ASSERT_DIALOG) - wxApp::OnAssert(file, line, cond, msg); + wxApp::OnAssertFailure(file, line, func, cond, msg); } } #endif @@ -1875,7 +1878,7 @@ wxString* wxString_in_helper(PyObject* source) { str = PyObject_Str(source); if (PyErr_Occurred()) return NULL; } - char* tmpPtr; int tmpSize; + char* tmpPtr; Py_ssize_t tmpSize; PyString_AsStringAndSize(str, &tmpPtr, &tmpSize); target = new wxString(tmpPtr, tmpSize); @@ -1918,7 +1921,7 @@ wxString Py2wxString(PyObject* source) str = PyObject_Str(source); if (PyErr_Occurred()) return wxEmptyString; // TODO: should we PyErr_Clear? } - char* tmpPtr; int tmpSize; + char* tmpPtr; Py_ssize_t tmpSize; PyString_AsStringAndSize(str, &tmpPtr, &tmpSize); target = wxString(tmpPtr, tmpSize);