X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/2f4c0a16186cae6d4a780b59314532fab473fb0b..31c7a57a37ed9a910fdf117dce9800d7d0edb099:/wxPython/contrib/glcanvas/msw/glcanvas_wrap.cpp diff --git a/wxPython/contrib/glcanvas/msw/glcanvas_wrap.cpp b/wxPython/contrib/glcanvas/msw/glcanvas_wrap.cpp index 6a5674405f..a8abe71083 100644 --- a/wxPython/contrib/glcanvas/msw/glcanvas_wrap.cpp +++ b/wxPython/contrib/glcanvas/msw/glcanvas_wrap.cpp @@ -328,7 +328,15 @@ SWIG_CheckLongInRange(long value, const char* type, SWIGSTATICINLINE(long) SWIG_AsLong(PyObject * obj) { - return PyInt_Check(obj) ? PyInt_AsLong(obj) : PyLong_AsLong(obj); + if (PyNumber_Check(obj)) + return PyInt_AsLong(obj); + else { + PyObject* errmsg = PyString_FromFormat("Expected number, got %s", + obj->ob_type->tp_name); + PyErr_SetObject(PyExc_TypeError, errmsg); + Py_DECREF(errmsg); + return 0; + } } @@ -428,6 +436,7 @@ static PyObject *_wrap_new_GLContext(PyObject *self, PyObject *args, PyObject *k SWIG_POINTER_EXCEPTION | 0)) == -1) SWIG_fail; } { + if (!wxPyCheckForApp()) SWIG_fail; PyThreadState* __tstate = wxPyBeginAllowThreads(); result = (wxGLContext *)new wxGLContext(arg1,arg2,(wxPalette const &)*arg3,(wxGLContext const *)arg4); @@ -677,6 +686,7 @@ static PyObject *_wrap_new_GLCanvas(PyObject *self, PyObject *args, PyObject *kw } } { + if (!wxPyCheckForApp()) SWIG_fail; PyThreadState* __tstate = wxPyBeginAllowThreads(); result = (wxGLCanvas *)new wxGLCanvas(arg1,arg2,(wxPoint const &)*arg3,(wxSize const &)*arg4,arg5,(wxString const &)*arg6,arg7,(wxPalette const &)*arg8); @@ -795,6 +805,7 @@ static PyObject *_wrap_new_GLCanvasWithContext(PyObject *self, PyObject *args, P } } { + if (!wxPyCheckForApp()) SWIG_fail; PyThreadState* __tstate = wxPyBeginAllowThreads(); result = (wxGLCanvas *)new wxGLCanvas(arg1,(wxGLContext const *)arg2,arg3,(wxPoint const &)*arg4,(wxSize const &)*arg5,arg6,(wxString const &)*arg7,arg8,(wxPalette const &)*arg9);