diff --git a/devsupApp/src/dbapi.c b/devsupApp/src/dbapi.c index 200e4f4..bff2e7f 100644 --- a/devsupApp/src/dbapi.c +++ b/devsupApp/src/dbapi.c @@ -269,7 +269,11 @@ static struct PyModuleDef dbapimodule = { }; #endif +#if PY_MAJOR_VERSION >= 3 +PyMODINIT_FUNC PyInit__dbapi(void) +#else PyMODINIT_FUNC init_dbapi(void) +#endif { PyObject *mod = NULL, *hookdict, *vertup; pystate *st; diff --git a/devsupApp/src/devsup/__init__.py b/devsupApp/src/devsup/__init__.py index ea6c48b..a84fcf8 100644 --- a/devsupApp/src/devsup/__init__.py +++ b/devsupApp/src/devsup/__init__.py @@ -52,7 +52,7 @@ device(mbboDirect, INST_IO, pydevsupComOut, "Python Device") device(waveform, INST_IO, pydevsupComIn, "Python Device") device(aai, INST_IO, pydevsupComIn, "Python Device") device(aao, INST_IO, pydevsupComOut, "Python Device") -""") +""".encode('ascii')) F.flush() _dbapi.dbReadDatabase(F.name) _dbapi._dbd_setup() diff --git a/devsupApp/src/devsup/test/test_db.py b/devsupApp/src/devsup/test/test_db.py index f543439..811292a 100644 --- a/devsupApp/src/devsup/test/test_db.py +++ b/devsupApp/src/devsup/test/test_db.py @@ -23,7 +23,7 @@ class IOCHelper(unittest.TestCase): if self.db is not None: with tempfile.NamedTemporaryFile() as F: - F.write(self.db) + F.write(self.db.encode('ascii')) F.flush() _dbapi.dbReadDatabase(F.name) @@ -159,7 +159,8 @@ class TestField(IOCHelper): rec.VAL = ["zero", "", "one", "This is a really long string which should be truncated", "", "last"] - assert_array_equal(rec.VAL, ["zero", "", "one", "This is a really long string which shoul", "", "last"]) + assert_array_equal(rec.VAL, + numpy.asarray(["zero", "", "one", "This is a really long string which shoul", "", "last"], dtype='S40')) class TestDset(IOCHelper):