From aedfdd1e15633eb850e7dc316afe6318161204db Mon Sep 17 00:00:00 2001 From: Petr Viktorin Date: Wed, 22 Nov 2017 13:28:47 +0100 Subject: [PATCH] Add _ldap.__version__ Cherry-picked from: b837b54 stripped trailing spaces from C source files --- Modules/ldapmodule.c | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/Modules/ldapmodule.c b/Modules/ldapmodule.c index a570220..c11bf72 100644 --- a/Modules/ldapmodule.c +++ b/Modules/ldapmodule.c @@ -1,7 +1,6 @@ /* See https://www.python-ldap.org/ for details. */ #include "common.h" -#include "version.h" #include "constants.h" #include "errors.h" #include "functions.h" @@ -9,6 +8,21 @@ #include "LDAPObject.h" +#define _STR(x) #x +#define STR(x) _STR(x) + +static char version_str[] = STR(LDAPMODULE_VERSION); + +void +LDAPinit_version( PyObject* d ) +{ + PyObject *version; + + version = PyString_FromString(version_str); + PyDict_SetItemString( d, "__version__", version ); + Py_DECREF(version); +} + DL_EXPORT(void) init_ldap(void); /* dummy module methods */