minor
This commit is contained in:
@ -101,8 +101,6 @@ static long add_record(dbCommon *prec)
|
||||
PyGILState_STATE pystate;
|
||||
long ret;
|
||||
|
||||
fprintf(stderr, "%s: init_record\n", prec->name);
|
||||
|
||||
if(!priv) {
|
||||
DBENTRY ent;
|
||||
|
||||
@ -169,6 +167,7 @@ static long add_record(dbCommon *prec)
|
||||
goto done;
|
||||
}
|
||||
assert(priv->support);
|
||||
assert(priv->pyrecord);
|
||||
ret = 0;
|
||||
done:
|
||||
PyGILState_Release(pystate);
|
||||
@ -180,8 +179,6 @@ static long del_record(dbCommon *prec)
|
||||
pyDevice *priv=prec->dpvt;
|
||||
PyGILState_STATE pystate;
|
||||
|
||||
fprintf(stderr, "%s: del_record. priv=%p\n", prec->name, priv);
|
||||
|
||||
if(!priv)
|
||||
return 0;
|
||||
|
||||
@ -194,6 +191,7 @@ static long del_record(dbCommon *prec)
|
||||
}
|
||||
|
||||
assert(!priv->support);
|
||||
assert(!priv->pyrecord);
|
||||
|
||||
PyGILState_Release(pystate);
|
||||
return 0;
|
||||
|
@ -172,26 +172,28 @@ static PyObject* pyField_putval(pyField *self, PyObject* args)
|
||||
}
|
||||
|
||||
static PyObject *pyField_getarray(pyField *self)
|
||||
#ifdef HAVE_NUMPY
|
||||
{
|
||||
#ifdef HAVE_NUMPY
|
||||
int flags = NPY_CARRAY;
|
||||
char *data=self->addr.pfield;
|
||||
npy_int dims[1] = {self->addr.no_elements};
|
||||
PyArray_Descr *desc;
|
||||
|
||||
if(self->addr.field_type>DBF_ENUM) {
|
||||
PyErr_SetString(PyExc_TypeError, "Can not map field type to numpy type");
|
||||
return NULL;
|
||||
}
|
||||
} else if(self->addr.field_type==DBF_STRING)
|
||||
dims[0] *= self->addr.field_size;
|
||||
|
||||
desc = dbf2np[self->addr.field_type];
|
||||
Py_XINCREF(desc);
|
||||
return PyArray_NewFromDescr(&PyArray_Type, desc, 1, dims, NULL, data, flags, (PyObject*)self);
|
||||
}
|
||||
|
||||
#else
|
||||
{
|
||||
PyErr_SetNone(PyExc_NotImplementedError);
|
||||
return NULL;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
static PyMethodDef pyField_methods[] = {
|
||||
{"name", (PyCFunction)pyField_name, METH_NOARGS,
|
||||
|
Reference in New Issue
Block a user