File tree Expand file tree Collapse file tree 1 file changed +13
-3
lines changed
Expand file tree Collapse file tree 1 file changed +13
-3
lines changed Original file line number Diff line number Diff line change 1- /* selectlib.c */
2-
31#include <Python.h>
42#include <listobject.h>
53#include <stdlib.h>
97#define PY_SSIZE_T_CLEAN
108#endif
119
10+ #ifndef SELECTLIB_VERSION
11+ #define SELECTLIB_VERSION "1.0.0"
12+ #endif
13+
1214/*
1315 Helper function that compares two PyObject*s using the < operator.
1416 Returns 1 if a < b, 0 if not, or -1 if an error occurred.
@@ -214,5 +216,13 @@ static struct PyModuleDef selectlibmodule = {
214216PyMODINIT_FUNC
215217PyInit_selectlib (void )
216218{
217- return PyModule_Create (& selectlibmodule );
219+ PyObject * m = PyModule_Create (& selectlibmodule );
220+ if (m == NULL )
221+ return NULL ;
222+ /* Add the module's version constant */
223+ if (PyModule_AddStringConstant (m , "__version__" , SELECTLIB_VERSION ) < 0 ) {
224+ Py_DECREF (m );
225+ return NULL ;
226+ }
227+ return m ;
218228}
You can’t perform that action at this time.
0 commit comments