The branch, master has been updated
       via  3b5417b pypamtest: Fix Python 2.6 compatibility
      from  7d45bbb Bump version to 1.0.4

https://git.samba.org/?p=pam_wrapper.git;a=shortlog;h=master


- Log -----------------------------------------------------------------
commit 3b5417be2f79a0d4bc9bf3c974ffd12219cb60b8
Author: Lumir Balhar <lbal...@redhat.com>
Date:   Fri Oct 13 15:36:15 2017 +0200

    pypamtest: Fix Python 2.6 compatibility
    
    PyErr_NewExceptionWithDoc() isn't available in Python 2.6 so it can
    be used only in higher versions of Python.
    
    Signed-off-by: Lumir Balhar <lbal...@redhat.com>
    Reviewed-by: Andrew Bartlet <abart...@samba.org>
    Reviewed-by: Andreas Schneider <a...@samba.org>

-----------------------------------------------------------------------

Summary of changes:
 src/python/pypamtest.c | 9 +++++++++
 1 file changed, 9 insertions(+)


Changeset truncated at 500 lines:

diff --git a/src/python/pypamtest.c b/src/python/pypamtest.c
index 585f27d..a71fd35 100644
--- a/src/python/pypamtest.c
+++ b/src/python/pypamtest.c
@@ -1004,12 +1004,14 @@ static struct PyModuleDef pypamtestdef = {
  *** Initialize the module
  **********************************************************/
 
+#if PY_VERSION_HEX >= 0x02070000 /* >= 2.7.0 */
 PyDoc_STRVAR(PamTestError__doc__,
 "pypamtest specific exception\n\n"
 "This exception is raised if the _pamtest() function fails. If _pamtest() "
 "returns PAMTEST_ERR_CASE (a test case returns unexpected error code), then "
 "the exception also details which test case failed."
 );
+#endif
 
 #if IS_PYTHON3
 PyMODINIT_FUNC PyInit_pypamtest(void)
@@ -1034,10 +1036,17 @@ PyMODINIT_FUNC initpypamtest(void)
                          pypamtest_module_methods);
 #endif
 
+#if PY_VERSION_HEX >= 0x02070000 /* >= 2.7.0 */
        PyExc_PamTestError = PyErr_NewExceptionWithDoc(discard_const_p(char, 
"pypamtest.PamTestError"),
                                                       PamTestError__doc__,
                                                       PyExc_EnvironmentError,
                                                       NULL);
+#else /* < 2.7.0 */
+       PyExc_PamTestError = PyErr_NewException(discard_const_p(char, 
"pypamtest.PamTestError"),
+                                                      PyExc_EnvironmentError,
+                                                      NULL);
+#endif
+
        if (PyExc_PamTestError == NULL) {
                RETURN_ON_ERROR;
        }


-- 
pam wrapper repository

Reply via email to