From d3348d437fb0408bc24892ebd0b035686c294705 Mon Sep 17 00:00:00 2001 From: Dag-Erling Smørgrav Date: Sun, 26 Apr 2015 11:23:26 +0000 Subject: import unbound 1.5.2 --- libunbound/python/libunbound.i | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'libunbound/python/libunbound.i') diff --git a/libunbound/python/libunbound.i b/libunbound/python/libunbound.i index 313c74862f4d..1bef79f22094 100644 --- a/libunbound/python/libunbound.i +++ b/libunbound/python/libunbound.i @@ -44,6 +44,10 @@ %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" @@ -699,7 +703,7 @@ Result: ['74.125.43.147', '74.125.43.99', '74.125.43.103', '74.125.43.104'] while (idx < slen): complen = ord(s[idx]) # In python 3.x `str()` converts the string to unicode which is the expected text string type - res.append(str(s[idx+1:idx+1+complen])) + res.append(str(s[idx+1:idx+1+complen].decode())) idx += complen + 1 return res -- cgit v1.3