Commit 225ced0f by Aron Podrigal Committed by Stéphane Graber

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: 's avatarAron Podrigal <aronp@guaranteedplus.com>
parent 2e6f9014
......@@ -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;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment