From 40251e4b3cf41f8a2390b92589a7874cd6d0d760 Mon Sep 17 00:00:00 2001 From: Pino Toscano Date: Thu, 9 Jan 2020 17:49:16 +0100 Subject: [PATCH] python: replace guestfs_int_py_fromstringsize in Py2 branches In Python 2 code branches use PyString_FromStringAndSize directly instead of the guestfs_int_py_fromstringsize wrapper (which calls PyString_FromStringAndSize anyway on Python < 3). --- generator/python.ml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/generator/python.ml b/generator/python.ml index 2a1a48fc0..0e1ed20d8 100644 --- a/generator/python.ml +++ b/generator/python.ml @@ -178,7 +178,7 @@ and generate_python_structs () = pr " value = PyBytes_FromStringAndSize (%s->%s, %s->%s_len);\n" typ name typ name; pr "#else\n"; - pr " value = guestfs_int_py_fromstringsize (%s->%s, %s->%s_len);\n" + pr " value = PyString_FromStringAndSize (%s->%s, %s->%s_len);\n" typ name typ name; pr "#endif\n"; pr " if (value == NULL)\n"; @@ -496,7 +496,7 @@ and generate_python_actions actions () = pr "#if PY_MAJOR_VERSION >= 3\n"; pr " py_r = PyBytes_FromStringAndSize (r, size);\n"; pr "#else\n"; - pr " py_r = guestfs_int_py_fromstringsize (r, size);\n"; + pr " py_r = PyString_FromStringAndSize (r, size);\n"; pr "#endif\n"; pr " free (r);\n"; pr " if (py_r == NULL) goto out;\n";