Author: bugman Date: Fri Oct 5 19:39:17 2012 New Revision: 17703 URL: http://svn.gna.org/viewcvs/relax?rev=17703&view=rev Log: First attempt at making the relaxation curve-fitting C module Python 3 compatible. Modified: trunk/maths_fns/relax_fit.c Modified: trunk/maths_fns/relax_fit.c URL: http://svn.gna.org/viewcvs/relax/trunk/maths_fns/relax_fit.c?rev=17703&r1=17702&r2=17703&view=diff ============================================================================== --- trunk/maths_fns/relax_fit.c (original) +++ trunk/maths_fns/relax_fit.c Fri Oct 5 19:39:17 2012 @@ -188,9 +188,33 @@ }; +/* Define the Python 3 module */ +#if PY_MAJOR_VERSION >= 3 + static struct PyModuleDef moduledef = { + PyModuleDef_HEAD_INIT, + "relax_fit", /* m_name */ + "Relaxation curve-fitting C module", /* m_doc */ + -1, /* m_size */ + relax_fit_methods, /* m_methods */ + NULL, /* m_reload */ + NULL, /* m_traverse */ + NULL, /* m_clear */ + NULL, /* m_free */ + }; +#endif + +/* Create the module */ +#if PY_MAJOR_VERSION >= 3 + m = PyModule_Create(&moduledef); +#endif + /* Initialise as a Python module */ PyMODINIT_FUNC -initrelax_fit(void) -{ - (void) Py_InitModule("relax_fit", relax_fit_methods); -} +#if PY_MAJOR_VERSION >= 3 + PyInit_relax_fit(void) +#else + initrelax_fit(void) + { + (void) Py_InitModule("relax_fit", relax_fit_methods); + } +#endif