]> git.saurik.com Git - wxWidgets.git/blobdiff - wxPython/contrib/stc/stc_wrap.cpp
reSWIGged
[wxWidgets.git] / wxPython / contrib / stc / stc_wrap.cpp
index 13d9c00f0f16fe64b48c246797337f21a356a9fb..a5e2ad39c7144756a31d9a7f4ba984d93704d0ca 100644 (file)
@@ -317,7 +317,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;
+    }
 }