X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/4f89f6a36b34749fd9bcad72cb99668bf26ac611..5ce4d9fa3788e3588105437688590d8490e557c8:/wxPython/contrib/iewin/iewin_wrap.cpp?ds=sidebyside diff --git a/wxPython/contrib/iewin/iewin_wrap.cpp b/wxPython/contrib/iewin/iewin_wrap.cpp index 6523504c2e..2f7735599e 100644 --- a/wxPython/contrib/iewin/iewin_wrap.cpp +++ b/wxPython/contrib/iewin/iewin_wrap.cpp @@ -310,7 +310,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; + } }