Skip to content

Commit 30f66a5

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 dfc0d8b commit 30f66a5

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
@@ -136,7 +135,6 @@
136135
// Defines to use Python 3 names in Python 2 code
137136
#define PyBytes_Type PyString_Type
138137
#define PyBytes_Check PyString_Check
139-
#define PyBytes_AS_STRING PyString_AS_STRING
140138
#define PyBytes_AsString PyString_AsString
141139
#define PyBytes_GET_SIZE PyString_GET_SIZE
142140
#define PyBytes_FromStringAndSize PyString_FromStringAndSize

0 commit comments

Comments
 (0)