summaryrefslogtreecommitdiff
path: root/python
diff options
context:
space:
mode:
Diffstat (limited to 'python')
-rw-r--r--python/pyglue.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/python/pyglue.c b/python/pyglue.c
index dee3c296e03..60592874ae6 100644
--- a/python/pyglue.c
+++ b/python/pyglue.c
@@ -74,6 +74,11 @@ static PyObject *py_generate_random_password(PyObject *self, PyObject *args)
retstr = generate_random_password(NULL, min, max);
if (retstr == NULL) {
+ if (errno == EINVAL) {
+ PyErr_Format(PyExc_ValueError,
+ "invalid range: %d - %d",
+ min, max);
+ }
return NULL;
}
ret = PyUnicode_FromString(retstr);
@@ -104,6 +109,11 @@ static PyObject *py_generate_random_machine_password(PyObject *self, PyObject *a
retstr = generate_random_machine_password(NULL, min, max);
if (retstr == NULL) {
+ if (errno == EINVAL) {
+ PyErr_Format(PyExc_ValueError,
+ "invalid range: %d - %d",
+ min, max);
+ }
return NULL;
}
ret = PyUnicode_FromString(retstr);