This commit is contained in:
Michael Davidsaver
2018-11-04 15:42:34 -08:00
parent 1abc792516
commit 2c34d9df52
3 changed files with 8 additions and 3 deletions

View File

@ -269,7 +269,11 @@ static struct PyModuleDef dbapimodule = {
}; };
#endif #endif
#if PY_MAJOR_VERSION >= 3
PyMODINIT_FUNC PyInit__dbapi(void)
#else
PyMODINIT_FUNC init_dbapi(void) PyMODINIT_FUNC init_dbapi(void)
#endif
{ {
PyObject *mod = NULL, *hookdict, *vertup; PyObject *mod = NULL, *hookdict, *vertup;
pystate *st; pystate *st;

View File

@ -52,7 +52,7 @@ device(mbboDirect, INST_IO, pydevsupComOut, "Python Device")
device(waveform, INST_IO, pydevsupComIn, "Python Device") device(waveform, INST_IO, pydevsupComIn, "Python Device")
device(aai, INST_IO, pydevsupComIn, "Python Device") device(aai, INST_IO, pydevsupComIn, "Python Device")
device(aao, INST_IO, pydevsupComOut, "Python Device") device(aao, INST_IO, pydevsupComOut, "Python Device")
""") """.encode('ascii'))
F.flush() F.flush()
_dbapi.dbReadDatabase(F.name) _dbapi.dbReadDatabase(F.name)
_dbapi._dbd_setup() _dbapi._dbd_setup()

View File

@ -23,7 +23,7 @@ class IOCHelper(unittest.TestCase):
if self.db is not None: if self.db is not None:
with tempfile.NamedTemporaryFile() as F: with tempfile.NamedTemporaryFile() as F:
F.write(self.db) F.write(self.db.encode('ascii'))
F.flush() F.flush()
_dbapi.dbReadDatabase(F.name) _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"] 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): class TestDset(IOCHelper):