X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/0dabb2a2c6ae27df135da4752b00579346bb74fc..6c7afb7435d11d7b67d16c51e1302cad5572491e:/wxPython/contrib/activex/activex_wrap.cpp diff --git a/wxPython/contrib/activex/activex_wrap.cpp b/wxPython/contrib/activex/activex_wrap.cpp index 7076c339a1..50fd6b3ee3 100644 --- a/wxPython/contrib/activex/activex_wrap.cpp +++ b/wxPython/contrib/activex/activex_wrap.cpp @@ -398,7 +398,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; + } }