summaryrefslogtreecommitdiff
path: root/usr/src/lib/pylibbe/common/libbe_py.c
diff options
context:
space:
mode:
Diffstat (limited to 'usr/src/lib/pylibbe/common/libbe_py.c')
-rw-r--r--usr/src/lib/pylibbe/common/libbe_py.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/usr/src/lib/pylibbe/common/libbe_py.c b/usr/src/lib/pylibbe/common/libbe_py.c
index 6e35228128..6402e0daad 100644
--- a/usr/src/lib/pylibbe/common/libbe_py.c
+++ b/usr/src/lib/pylibbe/common/libbe_py.c
@@ -202,9 +202,15 @@ beCopy(PyObject *self, PyObject *args)
NULL, NULL));
}
while (PyDict_Next(beNameProperties, &pos, &pkey, &pvalue)) {
+#if PY_MAJOR_VERSION >= 3
+ if (!convertPyArgsToNvlist(&beProps, 2,
+ PyUnicode_AsUTF8(pkey),
+ PyUnicode_AsUTF8(pvalue))) {
+#else
if (!convertPyArgsToNvlist(&beProps, 2,
- PyBytes_AS_STRING(pkey),
- PyBytes_AS_STRING(pvalue))) {
+ PyString_AsString(pkey),
+ PyString_AsString(pvalue))) {
+#endif
nvlist_free(beProps);
nvlist_free(beAttrs);
return (Py_BuildValue("[iss]", BE_PY_ERR_NVLIST,