From 90baa3cf2db4b0889a02d1509c25eb0316ad78e1 Mon Sep 17 00:00:00 2001 From: Jesse Luehrs Date: Tue, 21 Oct 2014 15:39:23 -0400 Subject: fix things under python 2 --- vt100module.c | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'vt100module.c') diff --git a/vt100module.c b/vt100module.c index 1eb8f37..9c44ae8 100644 --- a/vt100module.c +++ b/vt100module.c @@ -76,7 +76,11 @@ static PyObject *py_vt100_get_string_formatted(PyObject *self, PyObject *args) vt100_screen_get_string_formatted(vt, &start, &end, &outstr, &outlen); +#if PY_MAJOR_VERSION == 3 + return Py_BuildValue("y#", outstr, outlen); +#else return Py_BuildValue("s#", outstr, outlen); +#endif } static PyObject *py_vt100_get_string_plaintext(PyObject *self, PyObject *args) @@ -92,7 +96,11 @@ static PyObject *py_vt100_get_string_plaintext(PyObject *self, PyObject *args) vt100_screen_get_string_plaintext(vt, &start, &end, &outstr, &outlen); +#if PY_MAJOR_VERSION == 3 + return Py_BuildValue("y#", outstr, outlen); +#else return Py_BuildValue("s#", outstr, outlen); +#endif } static PyObject *py_vt100_delete(PyObject *self, PyObject *args) -- cgit v1.2.3-54-g00ecf