From 5b216fcb6575a348f0cdb6f2be32604fd3c06e0f Mon Sep 17 00:00:00 2001 From: Lukas Slebodnik Date: Apr 10 2018 21:13:33 +0000 Subject: [PATCH 1/2] UTIL: Use alternative way for detecting PyErr_NewExceptionWithDoc Function PyErr_NewExceptionWithDoc was added in python 2.7.0 and we use fallback implementation for older versions of python. Previously, we used detection of PyErr_NewExceptionWithDoc at configure time; but it does not work well in case of python2.6 and python3.x Resolves: https://pagure.io/SSSD/sssd/issue/3656 --- diff --git a/src/util/sss_python.c b/src/util/sss_python.c index ed607d0..0e2f971 100644 --- a/src/util/sss_python.c +++ b/src/util/sss_python.c @@ -23,7 +23,7 @@ PyObject * sss_exception_with_doc(char *name, char *doc, PyObject *base, PyObject *dict) { -#ifdef HAVE_PYERR_NEWEXCEPTIONWITHDOC +#if PY_VERSION_HEX >= 0x02070000 return PyErr_NewExceptionWithDoc(name, doc, base, dict); #else int result; From c57f5068fc9bf3fda7e14b1c211c849699f9a857 Mon Sep 17 00:00:00 2001 From: Lukas Slebodnik Date: Apr 10 2018 21:13:33 +0000 Subject: [PATCH 2/2] CONFIGURE: drop unused check Related to: https://pagure.io/SSSD/sssd/issue/3656 --- diff --git a/configure.ac b/configure.ac index 725c28f..36c10e1 100644 --- a/configure.ac +++ b/configure.ac @@ -329,7 +329,6 @@ them please use argument --without-python2-bindings when running configure.])]) AM_PYTHON_CONFIG([python2]) AM_CHECK_PYTHON_HEADERS([], AC_MSG_ERROR([Could not find python2 headers])) - AM_CHECK_PYTHON_COMPAT AC_SUBST([py2execdir], [$pyexecdir]) AC_SUBST([python2dir], [$pythondir]) @@ -356,7 +355,6 @@ them please use argument --without-python3-bindings when running configure.])]) AM_PYTHON_CONFIG([python3]) AM_CHECK_PYTHON_HEADERS([], AC_MSG_ERROR([Could not find python3 headers])) - AM_CHECK_PYTHON_COMPAT AC_SUBST([py3execdir], [$pyexecdir]) AC_SUBST([python3dir], [$pythondir]) diff --git a/src/external/python.m4 b/src/external/python.m4 index 691e600..be4e3b2 100644 --- a/src/external/python.m4 +++ b/src/external/python.m4 @@ -39,23 +39,6 @@ AC_DEFUN([AM_CHECK_PYTHON_HEADERS], CPPFLAGS="$save_CPPFLAGS" ]) - -dnl Checks for a couple of functions we use that may not be defined -dnl in some older python (< 2.6) versions used e.g. on RHEL6 -AC_DEFUN([AM_CHECK_PYTHON_COMPAT], -[ - AC_REQUIRE([AM_CHECK_PYTHON_HEADERS]) - save_CPPFLAGS="$CPPFLAGS" - save_LIBS="$LIBS" - CPPFLAGS="$CPPFLAGS $PYTHON_INCLUDES" - LIBS="$LIBS $PYTHON_LIBS" - - AC_CHECK_FUNCS([PyErr_NewExceptionWithDoc]) - - CPPFLAGS="$save_CPPFLAGS" - LIBS="$save_LIBS" -]) - dnl Clean variables after detection of python AC_DEFUN([SSS_CLEAN_PYTHON_VARIABLES], [