components/libxml2/patches/python34.patch
author John Beck <John.Beck@Oracle.COM>
Wed, 30 Jul 2014 16:12:03 -0700
changeset 2032 916ced318d1e
permissions -rw-r--r--
19317151 libxml2 needs Python 3 module

# This patch has been submitted upstream but not yet accepted:
# https://bugzilla.gnome.org/show_bug.cgi?id=734005

--- libxml2-2.9.1/python/drv_libxml2.py.~1~	2009-07-30 08:24:34.000000000 -0700
+++ libxml2-2.9.1/python/drv_libxml2.py	2014-07-30 10:43:36.655237802 -0700
@@ -38,8 +38,11 @@
 __version__ = "0.3"
 
 import codecs
-from types import StringType, UnicodeType
-StringTypes = (StringType,UnicodeType)
+try:
+    from types import StringType, UnicodeType
+    StringTypes = (StringType,UnicodeType)
+except:
+    StringTypes = (bytes,str)
 
 from xml.sax._exceptions import *
 from xml.sax import xmlreader, saxutils
@@ -65,7 +68,7 @@
 
 try:
     import libxml2
-except ImportError, e:
+except ImportError as e:
     raise SAXReaderNotAvailable("libxml2 not available: " \
                                 "import error was: %s" % e)