@@ -1230,7 +1230,7 @@ QStringList PythonQt::introspectObject(PyObject* object, ObjectType type)
12301230 } else {
12311231 PyObject* doc = PyObject_GetAttrString (object, " __doc__" );
12321232 if (doc) {
1233- QString docString = QString::fromUtf8 (PyString_AsString (doc));
1233+ QString docString = QString::fromUtf8 (PyUnicode_AsUTF8 (doc));
12341234 Py_DECREF (doc);
12351235 int idx = docString.indexOf (" \n " );
12361236 if (idx != -1 ) {
@@ -1266,7 +1266,7 @@ QStringList PythonQt::introspectObject(PyObject* object, ObjectType type)
12661266 value = PyObject_GetAttr (object, key);
12671267 }
12681268 if (!value) continue ;
1269- keystr = PyString_AsString (key);
1269+ keystr = PyUnicode_AsUTF8 (key);
12701270 static const QString underscoreStr (" __tmp" );
12711271 if (!keystr.startsWith (underscoreStr)) {
12721272 switch (type) {
@@ -1977,7 +1977,7 @@ QString PythonQt::getReturnTypeOfWrappedMethodHelper(const PythonQtObjectPtr& va
19771977 if (typeInfo && typeInfo->pythonQtClassWrapper ()) {
19781978 PyObject* s = PyObject_GetAttrString (typeInfo->pythonQtClassWrapper (), " __module__" );
19791979 Q_ASSERT (PyString_Check (s));
1980- type = QString (PyString_AsString (s)) + " ." + type;
1980+ type = QString (PyUnicode_AsUTF8 (s)) + " ." + type;
19811981 Py_DECREF (s);
19821982 }
19831983 }
@@ -2308,7 +2308,7 @@ const QMetaObject* PythonQtPrivate::buildDynamicMetaObject(PythonQtClassWrapper*
23082308 // A signal object, register with the meta object
23092309 PythonQtSignalFunctionObject* signal = (PythonQtSignalFunctionObject*)value;
23102310 if (signal->_dynamicInfo ) {
2311- signal->_dynamicInfo ->name = PyString_AsString (key);
2311+ signal->_dynamicInfo ->name = PyUnicode_AsUTF8 (key);
23122312 foreach (QByteArray sig, signal->_dynamicInfo ->signatures ) {
23132313 builder.addSignal (signal->_dynamicInfo ->name + " (" + sig + " )" );
23142314 needsMetaObject = true ;
@@ -2324,7 +2324,7 @@ const QMetaObject* PythonQtPrivate::buildDynamicMetaObject(PythonQtClassWrapper*
23242324 if (PythonQtProperty_Check (value)) {
23252325 needsMetaObject = true ;
23262326 PythonQtProperty* prop = (PythonQtProperty*)value;
2327- QMetaPropertyBuilder newProp = builder.addProperty (PyString_AsString (key), prop->data ->cppType );
2327+ QMetaPropertyBuilder newProp = builder.addProperty (PyUnicode_AsUTF8 (key), prop->data ->cppType );
23282328 newProp.setReadable (true );
23292329 newProp.setWritable (prop->data ->fset != nullptr );
23302330 newProp.setResettable (prop->data ->freset != nullptr );
@@ -2354,7 +2354,7 @@ const QMetaObject* PythonQtPrivate::buildDynamicMetaObject(PythonQtClassWrapper*
23542354 Py_ssize_t count = PyList_Size (signatures);
23552355 for (Py_ssize_t i = 0 ; i < count; i++) {
23562356 PyObject* signature = PyList_GET_ITEM (signatures, i);
2357- QByteArray sig = PyString_AsString (signature);
2357+ QByteArray sig = PyUnicode_AsUTF8 (signature);
23582358 // Split the return type and the rest of the signature,
23592359 // no spaces should be in the rest of the signature...
23602360 QList<QByteArray> parts = sig.split (' ' );
@@ -2473,14 +2473,14 @@ QString PythonQtPrivate::getSignature(PyObject* object)
24732473 QString docstr;
24742474 PyObject* doc = PyObject_GetAttrString (object, " __doc__" );
24752475 if (doc) {
2476- docstr = PyString_AsString (doc);
2476+ docstr = PyUnicode_AsUTF8 (doc);
24772477 Py_DECREF (doc);
24782478 }
24792479
24802480 PyObject* s = PyObject_GetAttrString (object, " __name__" );
24812481 if (s) {
24822482 Q_ASSERT (PyString_Check (s));
2483- signature = PyString_AsString (s);
2483+ signature = PyUnicode_AsUTF8 (s);
24842484 if (docstr.startsWith (signature + " (" )) {
24852485 signature = docstr;
24862486 } else {
@@ -2499,14 +2499,14 @@ QString PythonQtPrivate::getSignature(PyObject* object)
24992499 PyObject* s = PyObject_GetAttrString ((PyObject*)func, " __name__" );
25002500 if (s) {
25012501 Q_ASSERT (PyString_Check (s));
2502- funcName = PyString_AsString (s);
2502+ funcName = PyUnicode_AsUTF8 (s);
25032503 Py_DECREF (s);
25042504 }
25052505 if (method && funcName == " __init__" ) {
25062506 PyObject* s = PyObject_GetAttrString (object, " __name__" );
25072507 if (s) {
25082508 Q_ASSERT (PyString_Check (s));
2509- funcName = PyString_AsString (s);
2509+ funcName = PyUnicode_AsUTF8 (s);
25102510 Py_DECREF (s);
25112511 }
25122512 }
@@ -2525,18 +2525,18 @@ QString PythonQtPrivate::getSignature(PyObject* object)
25252525 for (int i=0 ; i<nargs; i++) {
25262526 PyObject* name = PyTuple_GetItem (co_varnames, i);
25272527 Q_ASSERT (PyString_Check (name));
2528- arguments << PyString_AsString (name);
2528+ arguments << PyUnicode_AsUTF8 (name);
25292529 }
25302530 if (code->co_flags & CO_VARARGS) {
25312531 PyObject* s = PyTuple_GetItem (co_varnames, nargs);
25322532 Q_ASSERT (PyString_Check (s));
2533- varargs = PyString_AsString (s);
2533+ varargs = PyUnicode_AsUTF8 (s);
25342534 nargs += 1 ;
25352535 }
25362536 if (code->co_flags & CO_VARKEYWORDS) {
25372537 PyObject* s = PyTuple_GetItem (co_varnames, nargs);
25382538 Q_ASSERT (PyString_Check (s));
2539- varkeywords = PyString_AsString (s);
2539+ varkeywords = PyUnicode_AsUTF8 (s);
25402540 }
25412541 Py_DECREF (co_varnames);
25422542 }
@@ -2548,7 +2548,7 @@ QString PythonQtPrivate::getSignature(PyObject* object)
25482548 PyObject* d = PyTuple_GetItem (defaultsTuple, i);
25492549 PyObject* s = PyObject_Repr (d);
25502550 Q_ASSERT (PyString_Check (s));
2551- defaults << PyString_AsString (s);
2551+ defaults << PyUnicode_AsUTF8 (s);
25522552 Py_DECREF (s);
25532553 }
25542554 }
0 commit comments