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
4 changes: 3 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,8 @@ jobs:
python: "3.7"
container: "python:3.7"
profile: deb10
test: # no - RuntimeError: Requires Base >=3.15 for iocBuildIsolated()

steps:
- uses: actions/checkout@v3
with:
Expand Down
17 changes: 8 additions & 9 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 @@ -118,15 +117,15 @@ static int assign_array(DBADDR *paddr, PyObject *arr)
#ifdef HAVE_NUMPY
void *rawfield = paddr->pfield;
rset *prset;
PyObject *aval;
PyArrayObject *array = (PyArrayObject *)arr;
PyArrayObject *aval;
PyArrayObject * array = (PyArrayObject *)arr;
unsigned elemsize = dbValueSize(paddr->field_type);
unsigned long maxlen = paddr->no_elements, insize;
PyArray_Descr *desc = dbf2np[paddr->field_type];

if(paddr->field_type==DBF_STRING &&
(PyArray_NDIM(array) != 2 ||
PyArray_DIM(array, 0) > (npy_intp) maxlen ||
(PyArray_NDIM(array) != 2 ||
PyArray_DIM(array, 0) > (npy_intp) maxlen ||
PyArray_DIM(array, 1) != MAX_STRING_SIZE))
{
PyErr_Format(PyExc_ValueError, "String array has incorrect shape or is too large");
Expand Down Expand Up @@ -159,17 +158,17 @@ 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);

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 @@ -130,7 +130,10 @@ static void cleanupPrep(initHookState state)
static void pySetupReg(void)
{
Py_InitializeEx(0);
#if NPY_TARGET_VERSION < NPY_1_9_API_VERSION

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor thing but I still get the deprecation warning with numpy 2.4.6 and python 3.14.6.

../setup.c: In function ‘pySetupReg’:
../setup.c:135:5: warning: ‘PyEval_InitThreads’ is deprecated [-Wdeprecated-declarations]
  135 |     PyEval_InitThreads();
      |     ^~~~~~~~~~~~~~~~~~
In file included from /usr/include/python3.14/Python.h:135,
                 from ../setup.c:8:
/usr/include/python3.14/ceval.h:114:37: note: declared here
  114 | Py_DEPRECATED(3.9) PyAPI_FUNC(void) PyEval_InitThreads(void);
      |                                     ^~~~~~~~~~~~~~~~~~
/usr/bin/ar -rc    libpyDevSup3.14.a    setup.o 

I think this should check if python is less than 3.7?

diff --git a/pyIocApp/setup.c b/pyIocApp/setup.c
index 0f87fe2..e9e36ca 100644
--- a/pyIocApp/setup.c
+++ b/pyIocApp/setup.c
@@ -130,8 +130,8 @@ static void cleanupPrep(initHookState state)
 static void pySetupReg(void)
 {
     Py_InitializeEx(0);
-#if NPY_TARGET_VERSION < NPY_1_9_API_VERSION
-    /* See https://docs.python.org/3/whatsnew/3.9.html */
+#if PY_VERSION_HEX < 0x03070000
+    /* See https://docs.python.org/3/c-api/threads.html#c.PyEval_InitThreads */
     PyEval_InitThreads();
 #endif

/* See https://docs.python.org/3/whatsnew/3.9.html */
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