Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .github/workflows/ci-scripts-build.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: pyDevSup

# Trigger on pushes and PRs to any branch
on: [push, pull_request]
on: [push, pull_request, workflow_dispatch]

env:
SETUP_PATH: .ci-local:.ci
Expand Down Expand Up @@ -159,6 +159,7 @@ jobs:
python: "3.7"
container: "python:3.7"
profile: deb10
test: # no - RuntimeError: Requires Base >=3.15 for iocBuildIsolated()

- os: windows-latest
cmp: vs2026
Expand Down
52 changes: 26 additions & 26 deletions devsupApp/src/dbfield.c
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
#undef _POSIX_C_SOURCE
#undef _XOPEN_SOURCE

#include <Python.h>
#ifdef HAVE_NUMPY
#include <numpy/ndarrayobject.h>
#endif
Expand Down Expand Up @@ -117,9 +116,9 @@ static int assign_array(DBADDR *paddr, PyObject *arr)
{
#ifdef HAVE_NUMPY
void *rawfield = paddr->pfield;
rset *prset;
PyObject *aval;
PyArrayObject *array = (PyArrayObject *)arr;
rset *prset = NULL;
PyArrayObject *aval = NULL;
PyArrayObject * array = (PyArrayObject *)arr;
unsigned elemsize = dbValueSize(paddr->field_type);
unsigned long maxlen = paddr->no_elements, insize;
PyArray_Descr *desc = dbf2np[paddr->field_type];
Expand All @@ -139,18 +138,20 @@ static int assign_array(DBADDR *paddr, PyObject *arr)

insize = PyArray_DIM(array, 0);

if(paddr->special==SPC_DBADDR &&
(prset=dbGetRset(paddr)) &&
prset->get_array_info)
if(paddr->special==SPC_DBADDR)
{
/* array */
char *datasave=paddr->pfield;
long noe, off;
if(prset->get_array_info(paddr, &noe, &off)) {
PyErr_Format(PyExc_ValueError, "Error fetching array info for %s.%s",
paddr->precord->name,
paddr->pfldDes->name);
return 1;
prset = dbGetRset(paddr);
void *datasave=paddr->pfield;
if (prset && prset->get_array_info)
{
/* array */
long noe, off;
if(prset->get_array_info(paddr, &noe, &off)) {
PyErr_Format(PyExc_ValueError, "Error fetching array info for %s.%s",
paddr->precord->name,
paddr->pfldDes->name);
return 1;
}
}

rawfield = paddr->pfield;
Expand All @@ -159,28 +160,27 @@ static int assign_array(DBADDR *paddr, PyObject *arr)
}

Py_XINCREF(desc);
if(!(aval = PyArray_FromAny(arr, desc, 1, 2, NPY_ARRAY_C_CONTIGUOUS | NPY_ARRAY_ALIGNED | NPY_ARRAY_WRITEABLE, arr)))
if(!(aval = (PyArrayObject *)PyArray_FromAny(arr, desc, 1, 2, NPY_ARRAY_C_CONTIGUOUS | NPY_ARRAY_ALIGNED | NPY_ARRAY_WRITEABLE, arr)))
return 1;

if(elemsize!=PyArray_ITEMSIZE((PyArrayObject *)aval)) {
if(elemsize!=PyArray_ITEMSIZE(aval)) {
PyErr_Format(PyExc_AssertionError, "item size mismatch %u %u",
elemsize, (unsigned)PyArray_ITEMSIZE((PyArrayObject *)aval));
elemsize, (unsigned)PyArray_ITEMSIZE(aval) );
Py_DECREF(aval);
return 1;
}

memcpy(rawfield, PyArray_GETPTR1((PyArrayObject *)aval, 0), insize*elemsize);
memcpy(rawfield, PyArray_GETPTR1(aval, 0), insize*elemsize);

Py_DECREF(aval);

if(paddr->special==SPC_DBADDR &&
(prset=dbGetRset(paddr)) &&
prset->get_array_info)
if(prset)
{
if(prset->put_array_info(paddr, insize)) {
PyErr_Format(PyExc_ValueError, "Error setting array info for %s.%s",
paddr->precord->name,
paddr->pfldDes->name);
if (prset->put_array_info)
if(prset->put_array_info(paddr, insize)) {
PyErr_Format(PyExc_ValueError, "Error setting array info for %s.%s",
paddr->precord->name,
paddr->pfldDes->name);
return 1;
}
}
Expand Down
1 change: 1 addition & 0 deletions devsupApp/src/devsup/disect.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

import sys, gc, inspect, time
try:
InstanceType = None
from types import InstanceType
except ImportError:
pass # py3
Expand Down
15 changes: 12 additions & 3 deletions documentation/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,18 @@ pydevsup documentation
It currently supports EPICS >=3.14.12 and python versions >=3.6
The numpy package is also required.

The source can be found at http://github.com/mdavidsaver/pyDevSup

File releases are available at https://github.com/mdavidsaver/pyDevSup/releases
It is not possible to use the module with a static build configuration.
The code will build, but it will not work.
The reason is that EPICS database defintions are created in two modules:
1. The _dbapi module creates the defintion of 'Python Device'.
2. The softIocPy module implements device types such as longin that use 'Python Device'.
In a static build, these are held in seperate EPICS databases.
Consequently the softIocPy module does not know what a 'Python Device' is.
In a shared library build there is ony one database, held by the underlying EPICS base library.

The source can be found at http://github.com/epics-modules/pyDevSup

File releases are available at https://github.com/epics-modules/pyDevSup/releases

Contents:

Expand Down
3 changes: 3 additions & 0 deletions pyIocApp/setup.c
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,10 @@ static void cleanupPrep(initHookState state)
static void pySetupReg(void)
{
Py_InitializeEx(0);
#if PY_VERSION_HEX < 0x03070000
/* See https://docs.python.org/3/c-api/threads.html#c.PyEval_InitThreads */
PyEval_InitThreads();
#endif

setupPyPath();

Expand Down
1 change: 0 additions & 1 deletion requirements-deb10.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
numpy==1.16.2
#nose==1.3.7
nose2
Loading