[Minipack] Modify fbfpgaiomodule.c to support both python2 and python3 (#7604)
Modify fbfpgaiomodule.c to support both python2 and python3 Signed-off-by: chiourung_huang <chiourung_huang@edge-core.com>
This commit is contained in:
parent
8f883fee67
commit
8e44b9e38e
@ -109,10 +109,7 @@ static PyMethodDef FbfpgaMethods[] = {
|
|||||||
{ NULL, NULL, 0, NULL },
|
{ NULL, NULL, 0, NULL },
|
||||||
};
|
};
|
||||||
|
|
||||||
PyMODINIT_FUNC
|
static char docstr[] = "\
|
||||||
initfbfpgaio(void)
|
|
||||||
{
|
|
||||||
char docstr[] = "\
|
|
||||||
1. hw_init():\n\
|
1. hw_init():\n\
|
||||||
return value: True/False\n\
|
return value: True/False\n\
|
||||||
2. hw_release():\n\
|
2. hw_release():\n\
|
||||||
@ -122,5 +119,26 @@ initfbfpgaio(void)
|
|||||||
In reading operation: data which is read from FPGA\n\
|
In reading operation: data which is read from FPGA\n\
|
||||||
In writing operation: None\n";
|
In writing operation: None\n";
|
||||||
|
|
||||||
|
#if PY_MAJOR_VERSION < 3
|
||||||
|
PyMODINIT_FUNC
|
||||||
|
initfbfpgaio(void)
|
||||||
|
{
|
||||||
(void) Py_InitModule3("fbfpgaio", FbfpgaMethods, docstr);
|
(void) Py_InitModule3("fbfpgaio", FbfpgaMethods, docstr);
|
||||||
}
|
}
|
||||||
|
#else
|
||||||
|
static struct PyModuleDef FbfpgaModule =
|
||||||
|
{
|
||||||
|
PyModuleDef_HEAD_INIT,
|
||||||
|
"fbfpgaio", /* name of module */
|
||||||
|
docstr,
|
||||||
|
-1, /* size of per-interpreter state of the module, or -1 if the module keeps state in global variables. */
|
||||||
|
FbfpgaMethods
|
||||||
|
};
|
||||||
|
|
||||||
|
PyMODINIT_FUNC
|
||||||
|
PyInit_fbfpgaio(void)
|
||||||
|
{
|
||||||
|
return PyModule_Create(&FbfpgaModule);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user