]> git.ipfire.org Git - people/ms/libloc.git/commitdiff
python: Use shorthand function to export __version__
authorMichael Tremer <michael.tremer@ipfire.org>
Sun, 13 Oct 2019 17:41:34 +0000 (17:41 +0000)
committerMichael Tremer <michael.tremer@ipfire.org>
Sun, 13 Oct 2019 17:41:34 +0000 (17:41 +0000)
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
src/python/locationmodule.c

index f9863701a2ee00d8498e870facb1c58fd2228b42..90620f7ddc5f05795404bb9acea65c26c67e1db6 100644 (file)
@@ -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))