Skip to content

Commit c29f86b

Browse files
author
florianlink
committed
fixed PY3K compilation
fixed MSVC 2015 const errors git-svn-id: http://svn.code.sf.net/p/pythonqt/code/trunk@437 ea8d5007-eb21-0410-b261-ccb3ea6e24a9
1 parent 64daef1 commit c29f86b

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

src/PythonQtConversion.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -748,8 +748,9 @@ QString PythonQtConv::PyObjGetString(PyObject* val, bool strict, bool& ok) {
748748
ok = true;
749749
#ifndef PY3K
750750
// in Python 3, we don't want to convert to QString, since we don't know anything about the encoding
751+
// in Python 2, we assume the default for str is latin-1
751752
if (val->ob_type == &PyBytes_Type) {
752-
r = QString(PyBytes_AS_STRING(val));
753+
r = QString::fromLatin1(PyBytes_AS_STRING(val));
753754
} else
754755
#endif
755756
if (PyUnicode_Check(val)) {
@@ -1523,7 +1524,7 @@ QByteArray PythonQtConv::getCPPTypeName(PyObject* type)
15231524
bool PythonQtConv::isStringType(PyTypeObject* type)
15241525
{
15251526
#ifdef PY3K
1526-
return type == &PyUnicode_Type
1527+
return type == &PyUnicode_Type;
15271528
#else
15281529
return type == &PyUnicode_Type || type == &PyString_Type;
15291530
#endif

src/PythonQtSlotDecorator.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,9 @@ int PythonQtSlotDecorator_init(PyObject *object, PyObject *args, PyObject *kw)
4242
char* argName = 0;
4343
PyObject* argResult = 0;
4444

45-
static char* kwlist[] = {"name", "result", 0};
45+
static const char* kwlist[] = {"name", "result", 0};
4646
static PyObject* emptyTuple = PyTuple_New(0);
47-
if (!PyArg_ParseTupleAndKeywords(emptyTuple, kw, "|sO:QtCore.Slot", kwlist, &argName, &argResult)) {
47+
if (!PyArg_ParseTupleAndKeywords(emptyTuple, kw, "|sO:QtCore.Slot", (char**) kwlist, &argName, &argResult)) {
4848
return 0;
4949
}
5050

0 commit comments

Comments
 (0)