File tree Expand file tree Collapse file tree 2 files changed +10
-7
lines changed
Expand file tree Collapse file tree 2 files changed +10
-7
lines changed Original file line number Diff line number Diff line change 1414#endif /* __inline__ */
1515#endif /* __STDC_VERSION__ < 199901L */
1616
17+ #ifndef Py_STRINGIFY
18+ #define ARC4_XSTRINGIFY (x ) #x
19+ #define Py_STRINGIFY (x ) ARC4_XSTRINGIFY(x)
20+ #endif
21+
1722struct arc4_state {
1823 unsigned char x , y , s [256 ];
1924};
@@ -313,7 +318,8 @@ PyInit_arc4(void)
313318 return NULL ;
314319 }
315320 Py_INCREF (& arc4_ARC4Type );
316- PyModule_AddStringConstant (module , "__version__" , ARC4_VERSION );
321+ PyModule_AddStringConstant (module , "__version__" ,
322+ Py_STRINGIFY (ARC4_VERSION ));
317323 PyModule_AddObject (module , "ARC4" , (PyObject * )& arc4_ARC4Type );
318324 return module ;
319325}
@@ -331,7 +337,8 @@ initarc4(void)
331337 return ;
332338 }
333339 Py_INCREF (& arc4_ARC4Type );
334- PyModule_AddStringConstant (module , "__version__" , ARC4_VERSION );
340+ PyModule_AddStringConstant (module , "__version__" ,
341+ Py_STRINGIFY (ARC4_VERSION ));
335342 PyModule_AddObject (module , "ARC4" , (PyObject * )& arc4_ARC4Type );
336343}
337344#endif /* PY_MAJOR_VERSION >= 3 */
Original file line number Diff line number Diff line change 77VERSION = '0.1.0'
88
99
10- def c_quote (string ):
11- return '"{}"' .format (string )
12-
13-
1410def read_file (path ):
1511 with open (path ) as f :
1612 return f .read ()
@@ -31,7 +27,7 @@ def read_file(path):
3127 ext_modules = [
3228 Extension ('arc4' ,
3329 sources = ['arc4.c' ],
34- define_macros = [('ARC4_VERSION' , c_quote ( VERSION ) )]),
30+ define_macros = [('ARC4_VERSION' , VERSION )]),
3531 ],
3632 classifiers = [
3733 'Development Status :: 4 - Beta' ,
You can’t perform that action at this time.
0 commit comments