File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -12,6 +12,8 @@ module instead.
1212
1313*/
1414
15+ #define MODULE_VERSION "1.0"
16+
1517#include "Python.h"
1618#include "structmember.h"
1719
@@ -1440,9 +1442,6 @@ PyMODINIT_FUNC
14401442init_csv (void )
14411443{
14421444 PyObject * module ;
1443- PyObject * rev ;
1444- PyObject * v ;
1445- int res ;
14461445 StyleDesc * style ;
14471446
14481447 if (PyType_Ready (& Dialect_Type ) < 0 )
@@ -1460,10 +1459,8 @@ init_csv(void)
14601459 return ;
14611460
14621461 /* Add version to the module. */
1463- rev = PyString_FromString ("1.0" );
1464- if (rev == NULL )
1465- return ;
1466- if (PyModule_AddObject (module , "__version__" , rev ) < 0 )
1462+ if (PyModule_AddStringConstant (module , "__version__" ,
1463+ MODULE_VERSION ) == -1 )
14671464 return ;
14681465
14691466 /* Add _dialects dictionary */
@@ -1475,11 +1472,8 @@ init_csv(void)
14751472
14761473 /* Add quote styles into dictionary */
14771474 for (style = quote_styles ; style -> name ; style ++ ) {
1478- v = PyInt_FromLong (style -> style );
1479- if (v == NULL )
1480- return ;
1481- res = PyModule_AddObject (module , style -> name , v );
1482- if (res < 0 )
1475+ if (PyModule_AddIntConstant (module , style -> name ,
1476+ style -> style ) == -1 )
14831477 return ;
14841478 }
14851479
You can’t perform that action at this time.
0 commit comments