Skip to content

Commit d2506eb

Browse files
committed
chore(PythonQt): replace PyString_Check with PyUnicode_Check
Update assertions and type checks to the Unicode API. No functional change intended.
1 parent 299ef1e commit d2506eb

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

src/PythonQt.cpp

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1976,7 +1976,7 @@ QString PythonQt::getReturnTypeOfWrappedMethodHelper(const PythonQtObjectPtr& va
19761976
PythonQtClassInfo* typeInfo = _p->_knownClassInfos.value(QStringToPythonConstCharPointer(type));
19771977
if (typeInfo && typeInfo->pythonQtClassWrapper()) {
19781978
PyObject* s = PyObject_GetAttrString(typeInfo->pythonQtClassWrapper(), "__module__");
1979-
Q_ASSERT(PyString_Check(s));
1979+
Q_ASSERT(PyUnicode_Check(s));
19801980
type = QString(PyUnicode_AsUTF8(s)) + "." + type;
19811981
Py_DECREF(s);
19821982
}
@@ -2479,7 +2479,7 @@ QString PythonQtPrivate::getSignature(PyObject* object)
24792479

24802480
PyObject* s = PyObject_GetAttrString(object, "__name__");
24812481
if (s) {
2482-
Q_ASSERT(PyString_Check(s));
2482+
Q_ASSERT(PyUnicode_Check(s));
24832483
signature = PyUnicode_AsUTF8(s);
24842484
if (docstr.startsWith(signature + "(")) {
24852485
signature = docstr;
@@ -2498,14 +2498,14 @@ QString PythonQtPrivate::getSignature(PyObject* object)
24982498
QString funcName;
24992499
PyObject* s = PyObject_GetAttrString((PyObject*)func, "__name__");
25002500
if (s) {
2501-
Q_ASSERT(PyString_Check(s));
2501+
Q_ASSERT(PyUnicode_Check(s));
25022502
funcName = PyUnicode_AsUTF8(s);
25032503
Py_DECREF(s);
25042504
}
25052505
if (method && funcName == "__init__") {
25062506
PyObject* s = PyObject_GetAttrString(object, "__name__");
25072507
if (s) {
2508-
Q_ASSERT(PyString_Check(s));
2508+
Q_ASSERT(PyUnicode_Check(s));
25092509
funcName = PyUnicode_AsUTF8(s);
25102510
Py_DECREF(s);
25112511
}
@@ -2524,18 +2524,18 @@ QString PythonQtPrivate::getSignature(PyObject* object)
25242524
Q_ASSERT(PyTuple_Check(co_varnames));
25252525
for (int i=0; i<nargs; i++) {
25262526
PyObject* name = PyTuple_GetItem(co_varnames, i);
2527-
Q_ASSERT(PyString_Check(name));
2527+
Q_ASSERT(PyUnicode_Check(name));
25282528
arguments << PyUnicode_AsUTF8(name);
25292529
}
25302530
if (code->co_flags & CO_VARARGS) {
25312531
PyObject* s = PyTuple_GetItem(co_varnames, nargs);
2532-
Q_ASSERT(PyString_Check(s));
2532+
Q_ASSERT(PyUnicode_Check(s));
25332533
varargs = PyUnicode_AsUTF8(s);
25342534
nargs += 1;
25352535
}
25362536
if (code->co_flags & CO_VARKEYWORDS) {
25372537
PyObject* s = PyTuple_GetItem(co_varnames, nargs);
2538-
Q_ASSERT(PyString_Check(s));
2538+
Q_ASSERT(PyUnicode_Check(s));
25392539
varkeywords = PyUnicode_AsUTF8(s);
25402540
}
25412541
Py_DECREF(co_varnames);
@@ -2547,7 +2547,7 @@ QString PythonQtPrivate::getSignature(PyObject* object)
25472547
for (Py_ssize_t i=0; i<PyTuple_Size(defaultsTuple); i++) {
25482548
PyObject* d = PyTuple_GetItem(defaultsTuple, i);
25492549
PyObject* s = PyObject_Repr(d);
2550-
Q_ASSERT(PyString_Check(s));
2550+
Q_ASSERT(PyUnicode_Check(s));
25512551
defaults << PyUnicode_AsUTF8(s);
25522552
Py_DECREF(s);
25532553
}

0 commit comments

Comments
 (0)