From: Michael Tremer Date: Thu, 2 Nov 2017 15:09:42 +0000 (+0100) Subject: problems: Show problem string in repr X-Git-Tag: 0.9.28~1285^2~1326 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d1df98ea5958cc107daaf801194521272e3dcb8a;p=pakfire.git problems: Show problem string in repr Signed-off-by: Michael Tremer --- diff --git a/src/_pakfire/problem.c b/src/_pakfire/problem.c index bd01ff9c0..1254a6073 100644 --- a/src/_pakfire/problem.c +++ b/src/_pakfire/problem.c @@ -72,6 +72,12 @@ static int Problem_init(ProblemObject* self, PyObject* args, PyObject* kwds) { return 0; } +static PyObject* Problem_repr(ProblemObject* self) { + const char* string = pakfire_problem_to_string(self->problem); + + return PyUnicode_FromFormat("<_pakfire.Problem %s>", string); +} + static PyObject* Problem_string(ProblemObject* self) { const char* string = pakfire_problem_to_string(self->problem); @@ -119,5 +125,6 @@ PyTypeObject ProblemType = { tp_doc: "Problem object", tp_methods: Problem_methods, tp_getset: Problem_getsetters, + tp_repr: (reprfunc)Problem_repr, tp_str: (reprfunc)Problem_string, };