]> git.saurik.com Git - wxWidgets.git/blobdiff - wxPython/contrib/iewin/iewin_wrap.cpp
reSWIGged
[wxWidgets.git] / wxPython / contrib / iewin / iewin_wrap.cpp
index 6523504c2e4215f52cce8fb19d87eb0abcc627de..2f7735599e83dbb344de8427cae783f3e6346152 100644 (file)
@@ -310,7 +310,15 @@ SWIG_CheckLongInRange(long value, const char* type,
 SWIGSTATICINLINE(long)
 SWIG_AsLong(PyObject * obj)
 {
 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;
+    }
 }
 
 
 }