py3: Base: files A-I ported to python3

issue 0000995
This commit is contained in:
Yorik van Havre
2017-05-16 17:56:34 +02:00
committed by wmayer
parent 80d1231068
commit ccebc7d16b
3 changed files with 164 additions and 15 deletions

View File

@@ -429,6 +429,18 @@ PyObject *ConsoleSingleton::sPyMessage(PyObject * /*self*/, PyObject *args, PyOb
if (!PyArg_ParseTuple(args, "O", &output))
return NULL;
#if PY_MAJOR_VERSION >= 3
const char* string=0;
PyObject* unicode=0;
if (PyUnicode_Check(output)) {
string = PyUnicode_AsUTF8(output);
}
else {
unicode = PyObject_Str(output);
if (unicode)
string = PyUnicode_AsUTF8(unicode);
}
#else
const char* string=0;
PyObject* unicode=0;
if (PyUnicode_Check(output)) {
@@ -444,6 +456,7 @@ PyObject *ConsoleSingleton::sPyMessage(PyObject * /*self*/, PyObject *args, PyOb
if (unicode)
string = PyString_AsString(unicode);
}
#endif
PY_TRY {
if (string)
@@ -462,6 +475,18 @@ PyObject *ConsoleSingleton::sPyWarning(PyObject * /*self*/, PyObject *args, PyOb
if (!PyArg_ParseTuple(args, "O", &output))
return NULL;
#if PY_MAJOR_VERSION >= 3
const char* string=0;
PyObject* unicode=0;
if (PyUnicode_Check(output)) {
string = PyUnicode_AsUTF8(output);
}
else {
unicode = PyObject_Str(output);
if (unicode)
string = PyUnicode_AsUTF8(unicode);
}
#else
const char* string=0;
PyObject* unicode=0;
if (PyUnicode_Check(output)) {
@@ -477,6 +502,7 @@ PyObject *ConsoleSingleton::sPyWarning(PyObject * /*self*/, PyObject *args, PyOb
if (unicode)
string = PyString_AsString(unicode);
}
#endif
PY_TRY {
if (string)
@@ -495,6 +521,18 @@ PyObject *ConsoleSingleton::sPyError(PyObject * /*self*/, PyObject *args, PyObje
if (!PyArg_ParseTuple(args, "O", &output))
return NULL;
#if PY_MAJOR_VERSION >= 3
const char* string=0;
PyObject* unicode=0;
if (PyUnicode_Check(output)) {
string = PyUnicode_AsUTF8(output);
}
else {
unicode = PyObject_Str(output);
if (unicode)
string = PyUnicode_AsUTF8(unicode);
}
#else
const char* string=0;
PyObject* unicode=0;
if (PyUnicode_Check(output)) {
@@ -510,6 +548,7 @@ PyObject *ConsoleSingleton::sPyError(PyObject * /*self*/, PyObject *args, PyObje
if (unicode)
string = PyString_AsString(unicode);
}
#endif
PY_TRY {
if (string)
@@ -528,6 +567,18 @@ PyObject *ConsoleSingleton::sPyLog(PyObject * /*self*/, PyObject *args, PyObject
if (!PyArg_ParseTuple(args, "O", &output))
return NULL;
#if PY_MAJOR_VERSION >= 3
const char* string=0;
PyObject* unicode=0;
if (PyUnicode_Check(output)) {
string = PyUnicode_AsUTF8(output);
}
else {
unicode = PyObject_Str(output);
if (unicode)
string = PyUnicode_AsUTF8(unicode);
}
#else
const char* string=0;
PyObject* unicode=0;
if (PyUnicode_Check(output)) {
@@ -543,6 +594,7 @@ PyObject *ConsoleSingleton::sPyLog(PyObject * /*self*/, PyObject *args, PyObject
if (unicode)
string = PyString_AsString(unicode);
}
#endif
PY_TRY {
if (string)