From 360ae5addaa0e815f0ec57f8609b653f3c1d5571 Mon Sep 17 00:00:00 2001 From: Michael Tremer Date: Fri, 29 Dec 2017 19:48:49 +0000 Subject: [PATCH] python: Fix setters Setters however expected a tuple instead of the value directly Signed-off-by: Michael Tremer --- src/python/as.c | 7 ++----- src/python/writer.c | 7 ++----- 2 files changed, 4 insertions(+), 10 deletions(-) diff --git a/src/python/as.c b/src/python/as.c index 3b28648..ec1573b 100644 --- a/src/python/as.c +++ b/src/python/as.c @@ -80,11 +80,8 @@ static PyObject* AS_get_name(ASObject* self) { return PyUnicode_FromString(name); } -static int AS_set_name(ASObject* self, PyObject* args) { - const char* name = NULL; - - if (!PyArg_ParseTuple(args, "s", &name)) - return -1; +static int AS_set_name(ASObject* self, PyObject* value) { + const char* name = PyUnicode_AsUTF8(value); int r = loc_as_set_name(self->as, name); if (r) { diff --git a/src/python/writer.c b/src/python/writer.c index f8a0838..6d4ea68 100644 --- a/src/python/writer.c +++ b/src/python/writer.c @@ -51,11 +51,8 @@ static PyObject* Writer_get_vendor(WriterObject* self) { return PyUnicode_FromString(vendor); } -static int Writer_set_vendor(WriterObject* self, PyObject* args) { - const char* vendor = NULL; - - if (!PyArg_ParseTuple(args, "s", &vendor)) - return -1; +static int Writer_set_vendor(WriterObject* self, PyObject* value) { + const char* vendor = PyUnicode_AsUTF8(value); int r = loc_writer_set_vendor(self->writer, vendor); if (r) { -- 2.39.2