py3: ported module init to python3

This commit is contained in:
wmayer
2016-01-23 15:30:29 +01:00
parent 915a1b18c4
commit 76b3397762
11 changed files with 92 additions and 37 deletions

View File

@@ -29,6 +29,7 @@
#endif
#include <Base/Console.h>
#include <Base/PyObjectBase.h>
#include <CXX/Extensions.hxx>
#include <CXX/Objects.hxx>
@@ -99,7 +100,7 @@ private:
quint16 p = server->serverPort();
Py::Tuple t(2);
t.setItem(0, Py::String((const char*)a.toLatin1()));
t.setItem(1, Py::Int(p));
t.setItem(1, Py::Long(p));
return t;
}
else {
@@ -125,15 +126,22 @@ private:
return Py::None();
}
};
PyObject* initModule()
{
return (new Module())->module().ptr();
}
} // namespace Web
/* Python entry */
PyMODINIT_FUNC initWeb() {
PyMOD_INIT_FUNC(Web) {
// ADD YOUR CODE HERE
//
//
new Web::Module();
PyObject* mod = Web::initModule();
Base::Console().Log("Loading Web module... done\n");
PyMOD_Return(mod);
}