summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--src/python/nxt_python.h1
-rw-r--r--src/python/nxt_python_wsgi.c4
2 files changed, 3 insertions, 2 deletions
diff --git a/src/python/nxt_python.h b/src/python/nxt_python.h
index 3211026b..3dd04e31 100644
--- a/src/python/nxt_python.h
+++ b/src/python/nxt_python.h
@@ -28,6 +28,7 @@
#define PyBytes_AS_STRING PyString_AS_STRING
#define PyUnicode_InternInPlace PyString_InternInPlace
#define PyUnicode_AsUTF8 PyString_AS_STRING
+#define PyUnicode_GET_LENGTH PyUnicode_GET_SIZE
#endif
#if PY_MAJOR_VERSION == 3 && PY_MINOR_VERSION >= 5
diff --git a/src/python/nxt_python_wsgi.c b/src/python/nxt_python_wsgi.c
index 97030cd3..8f692941 100644
--- a/src/python/nxt_python_wsgi.c
+++ b/src/python/nxt_python_wsgi.c
@@ -831,7 +831,7 @@ nxt_py_start_resp(PyObject *self, PyObject *args)
fields_size += PyBytes_GET_SIZE(string);
} else if (PyUnicode_Check(string)) {
- fields_size += PyUnicode_GET_SIZE(string);
+ fields_size += PyUnicode_GET_LENGTH(string);
} else {
return PyErr_Format(PyExc_TypeError,
@@ -843,7 +843,7 @@ nxt_py_start_resp(PyObject *self, PyObject *args)
fields_size += PyBytes_GET_SIZE(string);
} else if (PyUnicode_Check(string)) {
- fields_size += PyUnicode_GET_SIZE(string);
+ fields_size += PyUnicode_GET_LENGTH(string);
} else {
return PyErr_Format(PyExc_TypeError,