]> git.ipfire.org Git - thirdparty/unbound.git/commitdiff
- Fix pyunbound ord call, portable for python 2 and 3.
authorWouter Wijngaards <wouter@nlnetlabs.nl>
Mon, 12 Jan 2015 15:20:20 +0000 (15:20 +0000)
committerWouter Wijngaards <wouter@nlnetlabs.nl>
Mon, 12 Jan 2015 15:20:20 +0000 (15:20 +0000)
git-svn-id: file:///svn/unbound/trunk@3313 be551aaa-1e26-0410-a405-d3ace91eadb9

doc/Changelog
libunbound/python/libunbound.i

index b2465feada4dc57e610f8e71aa5090d188b65d21..b5208d7ff3a6e1e166949e2238386f56316ce565 100644 (file)
@@ -1,5 +1,6 @@
 12 January 2015: Wouter
        - Cast sun_len sizeof to socklen_t.
+       - Fix pyunbound ord call, portable for python 2 and 3.
 
 7 January 2015: Wouter
        - Fix warnings in pythonmod changes.
index 313c74862f4d0c96daef1e8b70987bd96352bcb4..633cc001823f13c1f254c8d95e01ac7d353b67ba 100644 (file)
 
 %pythoncode %{
    import encodings.idna
+   try:
+       import builtins
+   except ImportError:
+       import __builtin__ as builtins
 
    # Ensure compatibility with older python versions
    if 'bytes' not in vars():
@@ -52,7 +56,7 @@
    def ord(s):
        if isinstance(s, int):
            return s
-       return __builtins__.ord(s)
+       return builtins.ord(s)
 %}
 
 //%include "doc.i"