BIND 10 trac710, updated. ed6ec070b25a8995bccb3cec1a63cb111e06a6fb [trac710] make sure in xml_handler() the textual representation of XML is a correct string (not bytes, not a string in the form of "b'XXX'") regardless of whether xml.etree.ElementTree.tostring() returns bytes or string by default.

BIND 10 source code commits bind10-changes at lists.isc.org
Thu Jun 16 23:28:35 UTC 2011


The branch, trac710 has been updated
       via  ed6ec070b25a8995bccb3cec1a63cb111e06a6fb (commit)
       via  97131f9739d60c41a530a52c5f2a2861ba68637e (commit)
      from  dd3c0d1df47590362b21e7d582df513a98942a54 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit ed6ec070b25a8995bccb3cec1a63cb111e06a6fb
Author: JINMEI Tatuya <jinmei at isc.org>
Date:   Thu Jun 16 16:25:53 2011 -0700

    [trac710] make sure in xml_handler() the textual representation of XML
    is a correct string (not bytes, not a string in the form of "b'XXX'")
    regardless of whether xml.etree.ElementTree.tostring() returns bytes or
    string by default.

commit 97131f9739d60c41a530a52c5f2a2861ba68637e
Author: JINMEI Tatuya <jinmei at isc.org>
Date:   Thu Jun 16 16:17:28 2011 -0700

    [trac710] make sure -Wno-unused-parameter is placed after -Wextra.

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

Summary of changes:
 configure.ac                         |   54 +++++++++++++++++++---------------
 src/bin/stats/stats_httpd.py.in      |    9 +++++-
 src/lib/dns/python/Makefile.am       |    3 ++
 src/lib/util/io/Makefile.am          |    4 ++-
 src/lib/util/pyunittests/Makefile.am |    3 ++
 5 files changed, 47 insertions(+), 26 deletions(-)
 mode change 100644 => 100755 src/bin/stats/stats_httpd.py.in

-----------------------------------------------------------------------
diff --git a/configure.ac b/configure.ac
index 78ce507..19467cd 100644
--- a/configure.ac
+++ b/configure.ac
@@ -184,30 +184,6 @@ CPPFLAGS="$CPPFLAGS ${PYTHON_INCLUDES}"
 AC_CHECK_HEADERS([Python.h],, AC_MSG_ERROR([Missing Python.h]))
 CPPFLAGS="$CPPFLAGS_SAVED"
 
-# Python 3.2 has an unused parameter in one of its headers. This
-# has been reported, but not fixed as of yet, so we check if we need
-# to set -Wno-unused-parameter.
-CPPFLAGS_SAVED="$CPPFLAGS"
-CPPFLAGS="$CPPFLAGS ${PYTHON_INCLUDES} -Wall -Wextra -Werror"
-AC_MSG_CHECKING([whether we need -Wno-unused-parameter for python])
-AC_TRY_COMPILE(
-    [#include <Python.h>],
-    [],
-    [AC_MSG_RESULT(no)],
-    [
-    CPPFLAGS="$CPPFLAGS -Wno-unused-parameter"
-    AC_TRY_COMPILE([#include <Python.h>],
-        [],
-        [AC_MSG_RESULT(yes)
-         PYTHON_INCLUDES="${PYTHON_INCLUDES} -Wno-unused-parameter"
-         AC_SUBST(PYTHON_INCLUDES)
-        ],
-        [AC_MSG_ERROR([Can't compile against Python.h])]
-    )
-    ]
-)
-CPPFLAGS="$CPPFLAGS_SAVED"
-
 # Check for python library.  Needed for Python-wrapper libraries.
 LDFLAGS_SAVED="$LDFLAGS"
 LDFLAGS="$LDFLAGS $PYTHON_LDFLAGS"
@@ -304,6 +280,35 @@ namespace isc {class Bar {Foo foo_;};} ],,
 	[AC_MSG_RESULT(yes)])
 CXXFLAGS="$CXXFLAGS_SAVED"
 
+# Python 3.2 has an unused parameter in one of its headers. This
+# has been reported, but not fixed as of yet, so we check if we need
+# to set -Wno-unused-parameter.
+if test $werror_ok = 1; then
+	CPPFLAGS_SAVED="$CPPFLAGS"
+	CPPFLAGS=${PYTHON_INCLUDES}
+	CXXFLAGS_SAVED="$CXXFLAGS"
+	CXXFLAGS="$CXXFLAGS $B10_CXXFLAGS -Werror"
+	AC_MSG_CHECKING([whether we need -Wno-unused-parameter for python])
+	AC_TRY_COMPILE(
+		[#include <Python.h>],
+		[],
+		[AC_MSG_RESULT(no)],
+		[
+		CXXFLAGS="$CXXFLAGS -Wno-unused-parameter"
+		AC_TRY_COMPILE([#include <Python.h>],
+		[],
+		[AC_MSG_RESULT(yes)
+		 PYTHON_CXXFLAGS="${PYTHON_CXXFLAGS} -Wno-unused-parameter"
+		 AC_SUBST(PYTHON_CXXFLAGS)
+		],
+		[AC_MSG_ERROR([Can't compile against Python.h])]
+                )
+                ]
+	)
+	CXXFLAGS="$CXXFLAGS_SAVED"
+	CPPFLAGS="$CPPFLAGS_SAVED"
+fi
+
 fi				dnl GXX = yes
 
 AM_CONDITIONAL(GCC_WERROR_OK, test $werror_ok = 1)
@@ -978,6 +983,7 @@ Flags:
   B10_CXXFLAGS:  $B10_CXXFLAGS
 dnl includes too
   Python:        ${PYTHON_INCLUDES}
+                 ${PYTHON_CXXFLAGS}
                  ${PYTHON_LDFLAGS}
                  ${PYTHON_LIB}
   Boost:         ${BOOST_INCLUDES}
diff --git a/src/bin/stats/stats_httpd.py.in b/src/bin/stats/stats_httpd.py.in
old mode 100644
new mode 100755
index 72d2fc8..a6fd066
--- a/src/bin/stats/stats_httpd.py.in
+++ b/src/bin/stats/stats_httpd.py.in
@@ -437,8 +437,15 @@ class StatsHttpd:
             (k, v) = (str(k), str(v))
             elem = xml.etree.ElementTree.Element(k)
             elem.text = v
+            # The coding conversion is tricky. xml..tostring() of Python 3.2
+            # returns bytes (not string) regardless of the coding, while
+            # tostring() of Python 3.1 returns a string.  To support both
+            # cases transparently, we first make sure tostring() returns
+            # bytes by specifying utf-8 and then convert the result to a
+            # plain string (code below assume it).
             xml_list.append(
-                str(xml.etree.ElementTree.tostring(elem)))
+                str(xml.etree.ElementTree.tostring(elem, encoding='utf-8'),
+                    encoding='us-ascii'))
         xml_string = "".join(xml_list)
         self.xml_body = self.open_template(XML_TEMPLATE_LOCATION).substitute(
             xml_string=xml_string,
diff --git a/src/lib/dns/python/Makefile.am b/src/lib/dns/python/Makefile.am
index aa9d062..6c4ef54 100644
--- a/src/lib/dns/python/Makefile.am
+++ b/src/lib/dns/python/Makefile.am
@@ -16,6 +16,9 @@ pydnspp_la_SOURCES += tsigrecord_python.cc tsigrecord_python.h
 pydnspp_la_SOURCES += tsig_python.cc tsig_python.h
 
 pydnspp_la_CPPFLAGS = $(AM_CPPFLAGS) $(PYTHON_INCLUDES)
+# Note: PYTHON_CXXFLAGS may have some -Wno... workaround, which must be
+# placed after -Wextra defined in AM_CXXFLAGS
+pydnspp_la_CXXFLAGS = $(AM_CXXFLAGS) $(PYTHON_CXXFLAGS)
 pydnspp_la_LDFLAGS = $(PYTHON_LDFLAGS)
 
 # directly included from source files, so these don't have their own
diff --git a/src/lib/util/io/Makefile.am b/src/lib/util/io/Makefile.am
index b2653d8..cbcd54d 100644
--- a/src/lib/util/io/Makefile.am
+++ b/src/lib/util/io/Makefile.am
@@ -13,4 +13,6 @@ libutil_io_python_la_LDFLAGS = -module
 libutil_io_python_la_SOURCES = fdshare_python.cc
 libutil_io_python_la_LIBADD = libutil_io.la
 libutil_io_python_la_CPPFLAGS = $(AM_CPPFLAGS) $(PYTHON_INCLUDES)
-libutil_io_python_la_CXXFLAGS = $(AM_CXXFLAGS)
+# Note: PYTHON_CXXFLAGS may have some -Wno... workaround, which must be
+# placed after -Wextra defined in AM_CXXFLAGS
+libutil_io_python_la_CXXFLAGS = $(AM_CXXFLAGS) $(PYTHON_CXXFLAGS)
diff --git a/src/lib/util/pyunittests/Makefile.am b/src/lib/util/pyunittests/Makefile.am
index e8fefbd..63ccf2a 100644
--- a/src/lib/util/pyunittests/Makefile.am
+++ b/src/lib/util/pyunittests/Makefile.am
@@ -6,6 +6,9 @@ pyexec_LTLIBRARIES = pyunittests_util.la
 pyunittests_util_la_SOURCES = pyunittests_util.cc
 pyunittests_util_la_CPPFLAGS = $(AM_CPPFLAGS) $(PYTHON_INCLUDES)
 pyunittests_util_la_LDFLAGS = $(PYTHON_LDFLAGS)
+# Note: PYTHON_CXXFLAGS may have some -Wno... workaround, which must be
+# placed after -Wextra defined in AM_CXXFLAGS
+pyunittests_util_la_CXXFLAGS = $(AM_CXXFLAGS) $(PYTHON_CXXFLAGS)
 
 # Python prefers .so, while some OSes (specifically MacOS) use a different
 # suffix for dynamic objects.  -module is necessary to work this around.




More information about the bind10-changes mailing list