]> git.saurik.com Git - wxWidgets.git/blobdiff - wxPython/contrib/xrc/xrc_wrap.cpp
embedded sample's README updates
[wxWidgets.git] / wxPython / contrib / xrc / xrc_wrap.cpp
index e11dd11403bf1443a91c9b6dd2fd62a8186dd04f..723abd983419d4336b03537f968ab639e271a09b 100644 (file)
@@ -330,7 +330,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;
+    }
 }
 
 
 }