From: Dmitry Shachnev <mitya57@debian.org>
Date: Mon, 2 Sep 2019 15:51:37 +0300
Subject: Fixes for building against Python v2
Origin: upstream, changesets e5dd514fdba6 and 81b34c9373b6.
---
qpy/QtCore/qpycore_qstring.cpp | 14 +++++++++++++-
1 file changed, 13 insertions(+), 1 deletion(-)
diff --git qpy/QtCore/qpycore_qstring.cpp qpy/QtCore/qpycore_qstring.cpp
index 2d04e3a..4a188ce 100644
|
|
PyObject *qpycore_PyObject_FromQString(const QString &qstr) |
158 | 158 | } |
159 | 159 | |
160 | 160 | |
161 | | // Convert a Python Unicode object to a QString. |
| 161 | // Convert a Python string object to a QString. |
162 | 162 | QString qpycore_PyObject_AsQString(PyObject *obj) |
163 | 163 | { |
| 164 | #if PY_MAJOR_VERSION < 3 |
| 165 | if (PyString_Check(obj)) |
| 166 | { |
| 167 | const char *obj_s = PyString_AsString(obj); |
| 168 | |
| 169 | if (!obj_s) |
| 170 | return QString(); |
| 171 | |
| 172 | return QString::fromUtf8(obj_s); |
| 173 | } |
| 174 | #endif |
| 175 | |
164 | 176 | #if defined(PYQT_PEP_393) |
165 | 177 | int char_size; |
166 | 178 | Py_ssize_t len; |