Merge "Fix python3.9 building"
This commit is contained in:
commit
4cdc5b2a71
|
@ -6,11 +6,8 @@
|
|||
|
||||
#if PY_MAJOR_VERSION >= 3
|
||||
#define PY_SSIZE_T_CLEAN
|
||||
#include <Python.h>
|
||||
#define PyString_FromString PyUnicode_FromString
|
||||
#else
|
||||
#include <Python.h>
|
||||
#endif
|
||||
#include <Python.h>
|
||||
#include <stdio.h>
|
||||
#include "fmAPI.h"
|
||||
#include "fmAlarmUtils.h"
|
||||
|
@ -89,7 +86,7 @@ static PyObject * _fm_set(PyObject * self, PyObject *args) {
|
|||
|
||||
rc = fm_set_fault(&alm_data, &tmp_uuid);
|
||||
if (rc == FM_ERR_OK) {
|
||||
return PyString_FromString(&(tmp_uuid[0]));
|
||||
return PyUnicode_FromString(&(tmp_uuid[0]));
|
||||
}
|
||||
|
||||
if (rc == FM_ERR_NOCONNECT){
|
||||
|
@ -125,7 +122,7 @@ static PyObject * _fm_get(PyObject * self, PyObject *args) {
|
|||
rc = fm_get_fault(&af,&ad);
|
||||
if (rc == FM_ERR_OK) {
|
||||
fm_alarm_to_string(&ad,alm_str);
|
||||
return PyString_FromString(alm_str.c_str());
|
||||
return PyUnicode_FromString(alm_str.c_str());
|
||||
}
|
||||
|
||||
if (rc == FM_ERR_ENTITY_NOT_FOUND) {
|
||||
|
@ -170,7 +167,7 @@ static PyObject * _fm_get_by_aid(PyObject * self, PyObject *args, PyObject* kwar
|
|||
std::string s;
|
||||
fm_alarm_to_string(&lst[ix],s);
|
||||
if (s.size() > 0) {
|
||||
if (PyList_Append(__lst, PyString_FromString(s.c_str())) != 0) {
|
||||
if (PyList_Append(__lst, PyUnicode_FromString(s.c_str())) != 0) {
|
||||
ERROR_LOG("Failed to append alarm to the list");
|
||||
}
|
||||
}
|
||||
|
@ -219,7 +216,7 @@ static PyObject * _fm_get_by_eid(PyObject * self, PyObject *args, PyObject* kwar
|
|||
std::string s;
|
||||
fm_alarm_to_string(&lst[ix], s);
|
||||
if (s.size() > 0) {
|
||||
if (PyList_Append(__lst,PyString_FromString(s.c_str())) != 0) {
|
||||
if (PyList_Append(__lst,PyUnicode_FromString(s.c_str())) != 0) {
|
||||
ERROR_LOG("Failed to append alarm to the list");
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue