1313#include <asTrapWrite.h>
1414#include <asDbLib.h>
1515
16- /* In Python3 this function has been renamed. */
17- #if PY_MAJOR_VERSION >= 3
18- #define PyInt_FromLong (value ) PyLong_FromLong(value)
19- #endif
20-
2116/* Reference stealing version of PyDict_SetItemString */
2217static void set_dict_item_steal (
2318 PyObject * dict , const char * name , PyObject * py_value )
@@ -28,7 +23,7 @@ static void set_dict_item_steal(
2823
2924/* Helper for function below. */
3025#define ADD_ENUM (dict , name ) \
31- set_dict_item_steal(dict, #name, PyInt_FromLong (name))
26+ set_dict_item_steal(dict, #name, PyLong_FromLong (name))
3227
3328/* Alas, EPICS has changed the numerical assignments of the DBF_ enums between
3429 * versions, so to avoid unpleasant surprises, we compute thes values here in C
@@ -226,27 +221,16 @@ static struct PyMethodDef softioc_methods[] = {
226221 {NULL , NULL , 0 , NULL } /* Sentinel */
227222};
228223
229- #if PY_MAJOR_VERSION >= 3
224+
230225static struct PyModuleDef softioc_module = {
231226 PyModuleDef_HEAD_INIT ,
232227 "softioc._extension" ,
233228 NULL ,
234229 -1 ,
235230 softioc_methods ,
236231};
237- #endif
238-
239- #if PY_MAJOR_VERSION >= 3
240- # define PyMOD (NAME ) PyObject* PyInit_##NAME (void)
241- #else
242- # define PyMOD (NAME ) void init##NAME (void)
243- #endif
244232
245- PyMOD ( _extension )
233+ PyObject * PyInit__extension ( void )
246234{
247- #if PY_MAJOR_VERSION >= 3
248235 return PyModule_Create (& softioc_module );
249- #else
250- Py_InitModule ("softioc._extension" , softioc_methods );
251- #endif
252236}
0 commit comments