Fixed building with Python 3.9.

PyUnicode_GET_SIZE() in deprecated since 3.3 and will be removed in 3.12.
In version 3.9 it was explicitly marked by deprecation warning causing
compilation error with Unit.

PyUnicode_GET_LENGTH() must be used instead.
This commit is contained in:
Valentin Bartenev
2020-10-13 01:37:39 +03:00
parent c4f2a58aaf
commit 0919166145
2 changed files with 3 additions and 2 deletions

View File

@@ -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

View File

@@ -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,