From b0858fdc3790ef1d1f955bd584621c6fd539050d Mon Sep 17 00:00:00 2001 From: Alexander Pyhalov Date: Tue, 14 Jan 2020 21:23:25 +0300 Subject: 11522 illumos-gate has some runtime dependencies on Python 2.7 12192 python3 modules treat strings incorrectly Reviewed by: Andrew Stormont Reviewed by: Andy Fiddaman Reviewed by: Hans Rosenfeld Reviewed by: Toomas Soome Approved by: Dan McDonald --- usr/src/lib/pylibbe/common/libbe_py.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'usr/src/lib/pylibbe/common/libbe_py.c') 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, -- cgit v1.2.3