@@ -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) {
@@ -1978,7 +1978,7 @@ QString PythonQt::getReturnTypeOfWrappedMethodHelper(const PythonQtObjectPtr& va
19781978 if (typeInfo && typeInfo->pythonQtClassWrapper ()) {
19791979 PyObject* s = PyObject_GetAttrString (typeInfo->pythonQtClassWrapper (), " __module__" );
19801980 Q_ASSERT (PyString_Check (s));
1981- type = QString (PyString_AsString (s)) + " ." + type;
1981+ type = QString (PyUnicode_AsUTF8 (s)) + " ." + type;
19821982 Py_DECREF (s);
19831983 }
19841984 }
@@ -2309,7 +2309,7 @@ const QMetaObject* PythonQtPrivate::buildDynamicMetaObject(PythonQtClassWrapper*
23092309 // A signal object, register with the meta object
23102310 PythonQtSignalFunctionObject* signal = (PythonQtSignalFunctionObject*)value;
23112311 if (signal->_dynamicInfo ) {
2312- signal->_dynamicInfo ->name = PyString_AsString (key);
2312+ signal->_dynamicInfo ->name = PyUnicode_AsUTF8 (key);
23132313 for (const QByteArray& sig : qAsConst (signal->_dynamicInfo ->signatures )) {
23142314 builder.addSignal (signal->_dynamicInfo ->name + " (" + sig + " )" );
23152315 needsMetaObject = true ;
@@ -2325,7 +2325,7 @@ const QMetaObject* PythonQtPrivate::buildDynamicMetaObject(PythonQtClassWrapper*
23252325 if (PythonQtProperty_Check (value)) {
23262326 needsMetaObject = true ;
23272327 PythonQtProperty* prop = (PythonQtProperty*)value;
2328- QMetaPropertyBuilder newProp = builder.addProperty (PyString_AsString (key), prop->data ->cppType );
2328+ QMetaPropertyBuilder newProp = builder.addProperty (PyUnicode_AsUTF8 (key), prop->data ->cppType );
23292329 newProp.setReadable (true );
23302330 newProp.setWritable (prop->data ->fset != nullptr );
23312331 newProp.setResettable (prop->data ->freset != nullptr );
@@ -2355,7 +2355,7 @@ const QMetaObject* PythonQtPrivate::buildDynamicMetaObject(PythonQtClassWrapper*
23552355 Py_ssize_t count = PyList_Size (signatures);
23562356 for (Py_ssize_t i = 0 ; i < count; i++) {
23572357 PyObject* signature = PyList_GET_ITEM (signatures, i);
2358- QByteArray sig = PyString_AsString (signature);
2358+ QByteArray sig = PyUnicode_AsUTF8 (signature);
23592359 // Split the return type and the rest of the signature,
23602360 // no spaces should be in the rest of the signature...
23612361 QList<QByteArray> parts = sig.split (' ' );
@@ -2474,14 +2474,14 @@ QString PythonQtPrivate::getSignature(PyObject* object)
24742474 QString docstr;
24752475 PyObject* doc = PyObject_GetAttrString (object, " __doc__" );
24762476 if (doc) {
2477- docstr = PyString_AsString (doc);
2477+ docstr = PyUnicode_AsUTF8 (doc);
24782478 Py_DECREF (doc);
24792479 }
24802480
24812481 PyObject* s = PyObject_GetAttrString (object, " __name__" );
24822482 if (s) {
24832483 Q_ASSERT (PyString_Check (s));
2484- signature = PyString_AsString (s);
2484+ signature = PyUnicode_AsUTF8 (s);
24852485 if (docstr.startsWith (signature + " (" )) {
24862486 signature = docstr;
24872487 } else {
@@ -2500,14 +2500,14 @@ QString PythonQtPrivate::getSignature(PyObject* object)
25002500 PyObject* s = PyObject_GetAttrString ((PyObject*)func, " __name__" );
25012501 if (s) {
25022502 Q_ASSERT (PyString_Check (s));
2503- funcName = PyString_AsString (s);
2503+ funcName = PyUnicode_AsUTF8 (s);
25042504 Py_DECREF (s);
25052505 }
25062506 if (method && funcName == " __init__" ) {
25072507 PyObject* s = PyObject_GetAttrString (object, " __name__" );
25082508 if (s) {
25092509 Q_ASSERT (PyString_Check (s));
2510- funcName = PyString_AsString (s);
2510+ funcName = PyUnicode_AsUTF8 (s);
25112511 Py_DECREF (s);
25122512 }
25132513 }
@@ -2526,18 +2526,18 @@ QString PythonQtPrivate::getSignature(PyObject* object)
25262526 for (int i=0 ; i<nargs; i++) {
25272527 PyObject* name = PyTuple_GetItem (co_varnames, i);
25282528 Q_ASSERT (PyString_Check (name));
2529- arguments << PyString_AsString (name);
2529+ arguments << PyUnicode_AsUTF8 (name);
25302530 }
25312531 if (code->co_flags & CO_VARARGS) {
25322532 PyObject* s = PyTuple_GetItem (co_varnames, nargs);
25332533 Q_ASSERT (PyString_Check (s));
2534- varargs = PyString_AsString (s);
2534+ varargs = PyUnicode_AsUTF8 (s);
25352535 nargs += 1 ;
25362536 }
25372537 if (code->co_flags & CO_VARKEYWORDS) {
25382538 PyObject* s = PyTuple_GetItem (co_varnames, nargs);
25392539 Q_ASSERT (PyString_Check (s));
2540- varkeywords = PyString_AsString (s);
2540+ varkeywords = PyUnicode_AsUTF8 (s);
25412541 }
25422542 Py_DECREF (co_varnames);
25432543 }
@@ -2549,7 +2549,7 @@ QString PythonQtPrivate::getSignature(PyObject* object)
25492549 PyObject* d = PyTuple_GetItem (defaultsTuple, i);
25502550 PyObject* s = PyObject_Repr (d);
25512551 Q_ASSERT (PyString_Check (s));
2552- defaults << PyString_AsString (s);
2552+ defaults << PyUnicode_AsUTF8 (s);
25532553 Py_DECREF (s);
25542554 }
25552555 }
0 commit comments