From: Michael Tremer Date: Sun, 13 Oct 2019 17:41:34 +0000 (+0000) Subject: python: Use shorthand function to export __version__ X-Git-Tag: 0.9.0~41 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=0a56a83edb68a4e1cb03d943651e7409be290d43;p=people%2Fms%2Flibloc.git python: Use shorthand function to export __version__ Signed-off-by: Michael Tremer --- diff --git a/src/python/locationmodule.c b/src/python/locationmodule.c index f986370..90620f7 100644 --- a/src/python/locationmodule.c +++ b/src/python/locationmodule.c @@ -110,10 +110,8 @@ PyMODINIT_FUNC PyInit_location(void) { PyModule_AddObject(m, "Writer", (PyObject *)&WriterType); // Add constants - PyObject* d = PyModule_GetDict(m); - - // Version - PyDict_SetItemString(d, "__version__", PyUnicode_FromString(VERSION)); + if (PyModule_AddStringConstant(m, "__version__", VERSION)) + return NULL; // Add flags if (PyModule_AddIntConstant(m, "FLAG_ANONYMOUS_PROXY", LOC_NETWORK_FLAG_ANONYMOUS_PROXY))