aboutsummaryrefslogtreecommitdiffstats
path: root/vt100module.c
diff options
context:
space:
mode:
authorJesse Luehrs <doy@tozt.net>2014-10-21 15:39:23 -0400
committerJesse Luehrs <doy@tozt.net>2014-10-21 17:57:25 -0400
commit90baa3cf2db4b0889a02d1509c25eb0316ad78e1 (patch)
treec21d3e8e1cb42020779c6ee09720775b7ade25ef /vt100module.c
parentb353f760c7f9b9d1091f23b67ff35122c87abac3 (diff)
downloadlibvt100-python-90baa3cf2db4b0889a02d1509c25eb0316ad78e1.tar.gz
libvt100-python-90baa3cf2db4b0889a02d1509c25eb0316ad78e1.zip
fix things under python 2
Diffstat (limited to 'vt100module.c')
-rw-r--r--vt100module.c8
1 files changed, 8 insertions, 0 deletions
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)