3.14 compat

This commit is contained in:
Michael Davidsaver
2020-03-03 11:01:38 -08:00
parent ddf6bab236
commit 3620e1e013
2 changed files with 21 additions and 1 deletions

View File

@ -10,6 +10,8 @@
#include <stdio.h>
#include <epicsVersion.h>
#include <errlog.h>
#include <errMdef.h>
#include <dbCommon.h>
#include <dbAccess.h>
#include <dbStaticLib.h>
@ -240,7 +242,15 @@ PyObject *py_iocInit(PyObject *unused, PyObject *args, PyObject *kws)
isolate = PyObject_IsTrue(pyisolate);
Py_BEGIN_ALLOW_THREADS {
ret = isolate ? iocBuildIsolated() : iocBuild();
if(isolate) {
#if EPICS_VERSION_INT<VERSION_INT(3,15,0,0)
return PyErr_Format(PyExc_RuntimeError, "iocInit(isolate=True) requires Base>=3.15");
#else
ret = iocBuildIsolated();
#endif
} else {
ret = iocBuild();
}
if(!ret)
ret = iocRun();
} Py_END_ALLOW_THREADS

View File

@ -1,9 +1,19 @@
#ifndef PYDEVSUP_H
#define PYDEVSUP_H
#include <epicsVersion.h>
#include <epicsThread.h>
#include <initHooks.h>
#include <Python.h>
#ifndef VERSION_INT
# define VERSION_INT(V,R,M,P) ( ((V)<<24) | ((R)<<16) | ((M)<<8) | (P))
#endif
#ifndef EPICS_VERSION_INT
# define EPICS_VERSION_INT VERSION_INT(EPICS_VERSION, EPICS_REVISION, EPICS_MODIFICATION, EPICS_PATCH_LEVEL)
#endif
#if PY_MAJOR_VERSION >= 3
#define PyInt_FromLong PyLong_FromLong
#define PyInt_AsLong PyLong_AsLong