Base: remove Py2 code

This commit is contained in:
luz paz
2021-04-23 12:48:46 -04:00
committed by wwmayer
parent 31b0f25b6d
commit 142c2c2c4d
16 changed files with 0 additions and 546 deletions

View File

@@ -480,7 +480,6 @@ PyObject *ConsoleSingleton::sPyMessage(PyObject * /*self*/, PyObject *args)
if (!PyArg_ParseTuple(args, "O", &output))
return NULL;
#if PY_MAJOR_VERSION >= 3
const char* string=0;
PyObject* unicode=0;
if (PyUnicode_Check(output)) {
@@ -491,23 +490,6 @@ PyObject *ConsoleSingleton::sPyMessage(PyObject * /*self*/, PyObject *args)
if (unicode)
string = PyUnicode_AsUTF8(unicode);
}
#else
const char* string=0;
PyObject* unicode=0;
if (PyUnicode_Check(output)) {
unicode = PyUnicode_AsEncodedObject(output, "utf-8", "strict");
if (unicode)
string = PyString_AsString(unicode);
}
else if (PyString_Check(output)) {
string = PyString_AsString(output);
}
else {
unicode = PyObject_Str(output);
if (unicode)
string = PyString_AsString(unicode);
}
#endif
PY_TRY {
if (string)
@@ -526,7 +508,6 @@ PyObject *ConsoleSingleton::sPyWarning(PyObject * /*self*/, PyObject *args)
if (!PyArg_ParseTuple(args, "O", &output))
return NULL;
#if PY_MAJOR_VERSION >= 3
const char* string=0;
PyObject* unicode=0;
if (PyUnicode_Check(output)) {
@@ -537,23 +518,6 @@ PyObject *ConsoleSingleton::sPyWarning(PyObject * /*self*/, PyObject *args)
if (unicode)
string = PyUnicode_AsUTF8(unicode);
}
#else
const char* string=0;
PyObject* unicode=0;
if (PyUnicode_Check(output)) {
unicode = PyUnicode_AsEncodedObject(output, "utf-8", "strict");
if (unicode)
string = PyString_AsString(unicode);
}
else if (PyString_Check(output)) {
string = PyString_AsString(output);
}
else {
unicode = PyObject_Str(output);
if (unicode)
string = PyString_AsString(unicode);
}
#endif
PY_TRY {
if (string)
@@ -572,7 +536,6 @@ PyObject *ConsoleSingleton::sPyError(PyObject * /*self*/, PyObject *args)
if (!PyArg_ParseTuple(args, "O", &output))
return NULL;
#if PY_MAJOR_VERSION >= 3
const char* string=0;
PyObject* unicode=0;
if (PyUnicode_Check(output)) {
@@ -583,23 +546,6 @@ PyObject *ConsoleSingleton::sPyError(PyObject * /*self*/, PyObject *args)
if (unicode)
string = PyUnicode_AsUTF8(unicode);
}
#else
const char* string=0;
PyObject* unicode=0;
if (PyUnicode_Check(output)) {
unicode = PyUnicode_AsEncodedObject(output, "utf-8", "strict");
if (unicode)
string = PyString_AsString(unicode);
}
else if (PyString_Check(output)) {
string = PyString_AsString(output);
}
else {
unicode = PyObject_Str(output);
if (unicode)
string = PyString_AsString(unicode);
}
#endif
PY_TRY {
if (string)
@@ -618,7 +564,6 @@ PyObject *ConsoleSingleton::sPyLog(PyObject * /*self*/, PyObject *args)
if (!PyArg_ParseTuple(args, "O", &output))
return NULL;
#if PY_MAJOR_VERSION >= 3
const char* string=0;
PyObject* unicode=0;
if (PyUnicode_Check(output)) {
@@ -629,23 +574,6 @@ PyObject *ConsoleSingleton::sPyLog(PyObject * /*self*/, PyObject *args)
if (unicode)
string = PyUnicode_AsUTF8(unicode);
}
#else
const char* string=0;
PyObject* unicode=0;
if (PyUnicode_Check(output)) {
unicode = PyUnicode_AsEncodedObject(output, "utf-8", "strict");
if (unicode)
string = PyString_AsString(unicode);
}
else if (PyString_Check(output)) {
string = PyString_AsString(output);
}
else {
unicode = PyObject_Str(output);
if (unicode)
string = PyString_AsString(unicode);
}
#endif
PY_TRY {
if (string)
@@ -950,11 +878,7 @@ std::stringstream &LogLevel::prefix(std::stringstream &str, const char *src, int
PyFrameObject* frame = PyEval_GetFrame();
if (frame) {
line = PyFrame_GetLineNumber(frame);
#if PY_MAJOR_VERSION >= 3
src = PyUnicode_AsUTF8(frame->f_code->co_filename);
#else
src = PyString_AsString(frame->f_code->co_filename);
#endif
}
}
if (print_src && src && src[0]) {