]> git.saurik.com Git - wxWidgets.git/blobdiff - wxPython/contrib/glcanvas/msw/glcanvas_wrap.cpp
Print start and stop time
[wxWidgets.git] / wxPython / contrib / glcanvas / msw / glcanvas_wrap.cpp
index 6a5674405fcbaf81d2c7e27eb34e5df0d312b978..a8abe710838327024fdb557c3cc3364e304c51a2 100644 (file)
@@ -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);