summaryrefslogtreecommitdiff
path: root/src/python-systemd/_journal.c
diff options
context:
space:
mode:
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2013-05-08 21:08:14 -0400
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2013-05-08 21:34:44 -0400
commit5afbe712db5cc68213a24c45396ffb43fab05e3e (patch)
treee811f7b05a129c8220b33d6dbef301ac9ffc7da0 /src/python-systemd/_journal.c
parent6866780115a7c0af034f287d965f4bf6b02c1e6d (diff)
systemd-python: add __version__ strings
Diffstat (limited to 'src/python-systemd/_journal.c')
-rw-r--r--src/python-systemd/_journal.c21
1 files changed, 19 insertions, 2 deletions
diff --git a/src/python-systemd/_journal.c b/src/python-systemd/_journal.c
index 2de0d4f91d..f8e0b4f7f2 100644
--- a/src/python-systemd/_journal.c
+++ b/src/python-systemd/_journal.c
@@ -119,7 +119,13 @@ static PyMethodDef methods[] = {
#if PY_MAJOR_VERSION < 3
PyMODINIT_FUNC init_journal(void) {
- (void) Py_InitModule("_journal", methods);
+ PyObject *m;
+
+ m = Py_InitModule("_journal", methods);
+ if (m == NULL)
+ return;
+
+ PyModule_AddStringConstant(m, "__version__", PACKAGE_VERSION);
}
#else
@@ -133,7 +139,18 @@ static struct PyModuleDef module = {
};
PyMODINIT_FUNC PyInit__journal(void) {
- return PyModule_Create(&module);
+ PyObject *m;
+
+ m = PyModule_Create(&module);
+ if (m == NULL)
+ return NULL;
+
+ if (PyModule_AddStringConstant(m, "__version__", PACKAGE_VERSION)) {
+ Py_DECREF(m);
+ return NULL;
+ }
+
+ return m;
}
#endif