Mercurial > illumos > git > illumos-gate
changeset 19402:a89a57905c4c
12215 pyzfs module does not build with python 3.7
Reviewed by: Marcel Telka <marcel@telka.sk>
Reviewed by: Paul Winder <paul@winders.demon.co.uk>
Reviewed by: Alexander Pyhalov <apyhalov@gmail.com>
Approved by: Dan McDonald <danmcd@joyent.com>
author | Andy Fiddaman <omnios@citrus-it.co.uk> |
---|---|
date | Sun, 19 Jan 2020 10:41:22 +0000 |
parents | baf7b1352f78 |
children | 345a05acc665 |
files | usr/src/lib/pyzfs/common/ioctl.c |
diffstat | 1 files changed, 6 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/usr/src/lib/pyzfs/common/ioctl.c Wed Jan 08 11:44:12 2020 +0200 +++ b/usr/src/lib/pyzfs/common/ioctl.c Sun Jan 19 10:41:22 2020 +0000 @@ -143,10 +143,11 @@ assert(err == 0); while (PyDict_Next(d, &pos, &key, &value)) { + const char *keystr; #if PY_MAJOR_VERSION >= 3 - char *keystr = PyUnicode_AsUTF8(key); + keystr = PyUnicode_AsUTF8(key); #else - char *keystr = PyString_AsString(key); + keystr = PyString_AsString(key); #endif if (keystr == NULL) { PyErr_SetObject(PyExc_KeyError, key); @@ -165,10 +166,11 @@ #else } else if (PyString_Check(value)) { #endif + const char *valstr; #if PY_MAJOR_VERSION >= 3 - char *valstr = PyUnicode_AsUTF8(value); + valstr = PyUnicode_AsUTF8(value); #else - char *valstr = PyString_AsString(value); + valstr = PyString_AsString(value); #endif err = nvlist_add_string(nvl, keystr, valstr); } else if (PyLong_Check(value)) {