mirror of
https://github.com/libguestfs/libguestfs.git
synced 2026-03-21 22:53:37 +00:00
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).
This commit is contained in:
@@ -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";
|
||||
|
||||
Reference in New Issue
Block a user