fixed module related warnings

This commit is contained in:
Erik Fröjdh 2023-05-24 18:26:37 +02:00
parent 74263a7d7a
commit 44f9a58cf1

View File

@ -8,17 +8,6 @@
PyDoc_STRVAR(read_doc, "Read clusters from open file.\n\n"
"Parameters\n"
"----------\n"
"n: max number of clusters\n"
"Returns\n"
"----------\n"
"Array of clusters read\n\n");
// Create a custom numpy data type that should reflect // Create a custom numpy data type that should reflect
// our cluster data type. // our cluster data type.
// TODO! Update with the actual cluster data type // TODO! Update with the actual cluster data type
@ -46,7 +35,7 @@ typedef struct {
// raises python exception if something goes wrong // raises python exception if something goes wrong
// returned object should mean file is open and ready to read // returned object should mean file is open and ready to read
static int ClusterFileReader_init(ClusterFileReader *self, PyObject *args, static int ClusterFileReader_init(ClusterFileReader *self, PyObject *args,
PyObject *kwds) { PyObject * Py_UNUSED(kwds)) {
self->fp = NULL; self->fp = NULL;
// Parse file name // Parse file name
@ -83,7 +72,7 @@ ClusterFileReader_dealloc(ClusterFileReader *self)
// read method // read method
static PyObject * static PyObject *
ClusterFileReader_read(ClusterFileReader *self, PyObject *args, ClusterFileReader_read(ClusterFileReader *self, PyObject *args,
PyObject *kwds) PyObject * Py_UNUSED(kwds))
{ {
const int ndim = 1; const int ndim = 1;
@ -132,7 +121,7 @@ static PyMethodDef ClusterFileReader_methods[] = {
{"read", (PyCFunction) ClusterFileReader_read, METH_VARARGS, {"read", (PyCFunction) ClusterFileReader_read, METH_VARARGS,
"Read clusters" "Read clusters"
}, },
{NULL} /* Sentinel */ {NULL, NULL, 0, NULL} /* Sentinel */
}; };
@ -155,12 +144,21 @@ static PyTypeObject ClusterFileReaderType = {
static char module_docstring[] = static char module_docstring[] =
"C functions to read cluster files"; "C functions to read cluster files";
// This is the module itself // Methods in the module itself
static PyMethodDef module_methods[] = { static PyMethodDef module_methods[] = {
{NULL, NULL, 0, NULL}}; {NULL, NULL, 0, NULL}};
static struct PyModuleDef creader_def = {PyModuleDef_HEAD_INIT, "creader", static struct PyModuleDef creader_def = {
module_docstring, -1, module_methods}; PyModuleDef_HEAD_INIT, "creader",
module_docstring,
-1,
module_methods,
NULL, //m_slots
NULL, //m_traverse
NULL, //m_clear
NULL //m_free
};
PyMODINIT_FUNC PyInit_creader(void) { PyMODINIT_FUNC PyInit_creader(void) {
PyObject *m; PyObject *m;