diff options
| author | Alan Conway <aconway@apache.org> | 2014-06-26 22:31:49 +0000 |
|---|---|---|
| committer | Alan Conway <aconway@apache.org> | 2014-06-26 22:31:49 +0000 |
| commit | 67ec866ca46bdd9950d5ce24bc7f45c305e57321 (patch) | |
| tree | d294fffe933cc6385437d4c60680032199c8899e /qpid/cpp/include | |
| parent | edec5e6feef07b2a98481cec8bc8518dc729e2ad (diff) | |
| download | qpid-python-67ec866ca46bdd9950d5ce24bc7f45c305e57321.tar.gz | |
NO-JIRA: Error handling in swig_python_typemaps: don't core dump if qpid.datatypes is not found.
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk@1605920 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'qpid/cpp/include')
| -rw-r--r-- | qpid/cpp/include/qpid/swig_python_typemaps.i | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/qpid/cpp/include/qpid/swig_python_typemaps.i b/qpid/cpp/include/qpid/swig_python_typemaps.i index e9a84ffa8e..0fc4d9019f 100644 --- a/qpid/cpp/include/qpid/swig_python_typemaps.i +++ b/qpid/cpp/include/qpid/swig_python_typemaps.i @@ -30,13 +30,16 @@ static PyObject* pUuidModule; * qpid.datatypes. */ pUuidModule = PyImport_ImportModule("qpid.datatypes"); - - /* Although it is not required, we'll publish the uuid module in our - * module, as if this module was a python module and we called - * "import uuid" - */ - Py_INCREF(pUuidModule); - PyModule_AddObject(m, "uuid", pUuidModule); + if (pUuidModule) { + /* Although it is not required, we'll publish the uuid module in our + * module, as if this module was a python module and we called + * "import uuid" + */ + Py_INCREF(pUuidModule); + PyModule_AddObject(m, "uuid", pUuidModule); + } else { + if (!PyErr_Occurred) PyErr_SetString(PyExc_ImportError, "Cannot import qpid.datatypes"); + } %} @@ -101,7 +104,7 @@ typedef int Py_ssize_t; result = PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) v->asUint64()); break; } - case qpid::types::VAR_INT8 : + case qpid::types::VAR_INT8 : case qpid::types::VAR_INT16 : case qpid::types::VAR_INT32 : { result = PyInt_FromLong((long) v->asInt32()); |
