Skip to content

Commit ff9a147

Browse files
committed
chore(PythonQt): replace PyString_AS_STRING with PyUnicode_AsUTF8
This removes dependence on the `PyString_*` shim and documents the Python 3 assumption clearly. No functional change intended.
1 parent 65ef625 commit ff9a147

File tree

2 files changed

+1
-3
lines changed

2 files changed

+1
-3
lines changed

src/PythonQt.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -986,7 +986,7 @@ QVariant PythonQt::evalCode(PyObject* object, PyObject* pycode) {
986986
globals = dict;
987987
} else {
988988
dict = PyObject_GetAttrString(object, "__dict__");
989-
globals = PyObject_GetAttrString(PyImport_ImportModule(PyString_AS_STRING(PyObject_GetAttrString(object, "__module__"))),"__dict__");
989+
globals = PyObject_GetAttrString(PyImport_ImportModule(PyUnicode_AsUTF8(PyObject_GetAttrString(object, "__module__"))),"__dict__");
990990
}
991991
PyObject* r = nullptr;
992992
if (dict) {

src/PythonQtPythonInclude.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,6 @@
121121
#define PY3K
122122
// Helper defines to facilitate porting
123123
#define PyString_FromString PyUnicode_FromString
124-
#define PyString_AS_STRING PyUnicode_AsUTF8
125124
#define PyString_AsString PyUnicode_AsUTF8
126125
#define PyString_FromFormat PyUnicode_FromFormat
127126
#define PyString_Check PyUnicode_Check
@@ -130,7 +129,6 @@
130129
// Defines to use Python 3 names in Python 2 code
131130
#define PyBytes_Type PyString_Type
132131
#define PyBytes_Check PyString_Check
133-
#define PyBytes_AS_STRING PyString_AS_STRING
134132
#define PyBytes_AsString PyString_AsString
135133
#define PyBytes_GET_SIZE PyString_GET_SIZE
136134
#define PyBytes_FromStringAndSize PyString_FromStringAndSize

0 commit comments

Comments
 (0)