From d17b312471b1170fad39b4dd25af189c782aecb2 Mon Sep 17 00:00:00 2001 From: Wouter Wijngaards Date: Thu, 29 Jan 2015 16:10:51 +0000 Subject: [PATCH] - Fix pyunbound byte string representation for python3. git-svn-id: file:///svn/unbound/trunk@3322 be551aaa-1e26-0410-a405-d3ace91eadb9 --- doc/Changelog | 3 +++ libunbound/python/libunbound.i | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/doc/Changelog b/doc/Changelog index 85bb8d43e..b2ba34998 100644 --- a/doc/Changelog +++ b/doc/Changelog @@ -1,3 +1,6 @@ +29 January 2015: Wouter + - Fix pyunbound byte string representation for python3. + 26 January 2015: Wouter - Fix unintended use of gcc extension for incomplete enum types, compile with pedantic c99 compliance (from Daniel Dickman). diff --git a/libunbound/python/libunbound.i b/libunbound/python/libunbound.i index 633cc0018..1bef79f22 100644 --- a/libunbound/python/libunbound.i +++ b/libunbound/python/libunbound.i @@ -703,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