From 0a56a83edb68a4e1cb03d943651e7409be290d43 Mon Sep 17 00:00:00 2001 From: Michael Tremer Date: Sun, 13 Oct 2019 17:41:34 +0000 Subject: [PATCH] python: Use shorthand function to export __version__ Signed-off-by: Michael Tremer --- src/python/locationmodule.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) 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)) -- 2.47.2