ia64/xen-unstable
changeset 10116:ae0175bf0631
Expose the exceptions thrown by xen.lowlevel.xc so they can be caught.
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
author | Anthony Liguori <anthony@codemonkey.ws> |
---|---|
date | Fri May 19 17:31:28 2006 +0100 (2006-05-19) |
parents | 9b11eeab4558 |
children | d0d9f50517f7 |
files | tools/python/xen/lowlevel/xc/xc.c |
line diff
1.1 --- a/tools/python/xen/lowlevel/xc/xc.c Fri May 19 16:30:21 2006 +0100 1.2 +++ b/tools/python/xen/lowlevel/xc/xc.c Fri May 19 17:31:28 2006 +0100 1.3 @@ -1172,7 +1172,7 @@ static int 1.4 PyXc_init(XcObject *self, PyObject *args, PyObject *kwds) 1.5 { 1.6 if ((self->xc_handle = xc_interface_open()) == -1) { 1.7 - PyErr_SetFromErrno(PyExc_RuntimeError); 1.8 + PyErr_SetFromErrno(xc_error); 1.9 return -1; 1.10 } 1.11 1.12 @@ -1245,7 +1245,7 @@ PyMODINIT_FUNC initxc(void) 1.13 if (m == NULL) 1.14 return; 1.15 1.16 - xc_error = PyErr_NewException(PKG ".error", NULL, NULL); 1.17 + xc_error = PyErr_NewException(PKG ".Error", PyExc_RuntimeError, NULL); 1.18 zero = PyInt_FromLong(0); 1.19 1.20 /* KAF: This ensures that we get debug output in a timely manner. */ 1.21 @@ -1254,6 +1254,9 @@ PyMODINIT_FUNC initxc(void) 1.22 1.23 Py_INCREF(&PyXcType); 1.24 PyModule_AddObject(m, CLS, (PyObject *)&PyXcType); 1.25 + 1.26 + Py_INCREF(xc_error); 1.27 + PyModule_AddObject(m, "Error", xc_error); 1.28 } 1.29 1.30