From: Aron Podrigal Date: Sun, 1 May 2016 15:06:53 +0000 (-0400) Subject: Fixed - set PyErr when Container.__init__ fails X-Git-Tag: lxc-1.0.9~61 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=cfaa839ee069e273434f80a7f6cde78235a936bd;p=thirdparty%2Flxc.git Fixed - set PyErr when Container.__init__ fails When container init failed for whatever reason, previously it resulted in a `SystemError: NULL result without error in PyObject_Call` This will now result in a RuntimeError with the error message previously printed to stderr. Signed-off-by: Aron Podrigal --- diff --git a/src/python-lxc/lxc.c b/src/python-lxc/lxc.c index b45ff7b97..cc7ad447b 100644 --- a/src/python-lxc/lxc.c +++ b/src/python-lxc/lxc.c @@ -449,7 +449,9 @@ Container_init(Container *self, PyObject *args, PyObject *kwds) self->container = lxc_container_new(name, config_path); if (!self->container) { Py_XDECREF(fs_config_path); - fprintf(stderr, "%d: error creating container %s\n", __LINE__, name); + + PyErr_Format(PyExc_RuntimeError, "%s:%s:%d: error during init for container '%s'.", + __FUNCTION__, __FILE__, __LINE__, name); return -1; }