summaryrefslogtreecommitdiffstats
path: root/src/xmlpythonizer.c
diff options
context:
space:
mode:
authorSlavek Kabrda <bkabrda@redhat.com>2015-01-21 12:57:35 +0100
committerDavid Sommerseth <davids@redhat.com>2015-02-03 21:16:25 +0100
commit5cc3d02060f67317049b6e0549c87a407e030e61 (patch)
tree15174b46cabd9ea08a1c9c35ebb831018577f00f /src/xmlpythonizer.c
parent9fa1352cd540aa69dd8b59e56de9b8020563e545 (diff)
downloadpython-dmidecode-5cc3d02060f67317049b6e0549c87a407e030e61.tar.gz
python-dmidecode-5cc3d02060f67317049b6e0549c87a407e030e61.tar.xz
python-dmidecode-5cc3d02060f67317049b6e0549c87a407e030e61.zip
Port to Python 3 while maintaining compatibility with Python >= 2.6
Signed-off-by: David Sommerseth <davids@redhat.com>
Diffstat (limited to 'src/xmlpythonizer.c')
-rw-r--r--src/xmlpythonizer.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/xmlpythonizer.c b/src/xmlpythonizer.c
index e318023..e9c9242 100644
--- a/src/xmlpythonizer.c
+++ b/src/xmlpythonizer.c
@@ -85,6 +85,7 @@
#include "dmilog.h"
#include "xmlpythonizer.h"
#include "version.h"
+#include "compat.h"
/**
@@ -646,7 +647,7 @@ inline PyObject *StringToPyObj(Log_t *logp, ptzMAP *val_m, const char *instr) {
switch( val_m->type_value ) {
case ptzINT:
case ptzLIST_INT:
- value = PyInt_FromLong(atoi(workstr));
+ value = PYNUMBER_FROMLONG(atoi(workstr));
break;
case ptzFLOAT:
@@ -661,7 +662,7 @@ inline PyObject *StringToPyObj(Log_t *logp, ptzMAP *val_m, const char *instr) {
case ptzSTR:
case ptzLIST_STR:
- value = PyString_FromString(workstr);
+ value = PyBytes_FromString(workstr);
break;
default:
@@ -850,7 +851,7 @@ PyObject *_deep_pythonize(Log_t *logp, PyObject *retdata,
switch( map_p->type_value ) {
case ptzCONST:
if( _get_key_value(logp, key, 256, map_p, xpctx, 0) != NULL ) {
- value = PyString_FromString(map_p->value);
+ value = PyBytes_FromString(map_p->value);
PyADD_DICT_VALUE(retdata, key, value);
} else {
PyReturnError(PyExc_ValueError, "Could not get key value: %s [%i] (Defining key: %s)",