From 4e8fda517cc906cd6d67746ba60b1c468175a7f7 Mon Sep 17 00:00:00 2001
From: "Stuart D. Gathman" <stuart@gathman.org>
Date: Sun, 23 Dec 2018 23:16:42 -0500
Subject: [PATCH] Fix getsymval for python3

---
 Milter/test.py    | 5 ++++-
 Milter/testctx.py | 7 +++++--
 2 files changed, 9 insertions(+), 3 deletions(-)

diff --git a/Milter/test.py b/Milter/test.py
index 846752e..55b27bf 100644
--- a/Milter/test.py
+++ b/Milter/test.py
@@ -63,7 +63,10 @@ class TestBase(object):
       syms = self._symlist[stage]
       if syms is not None and name not in syms:
         return None
-    return self._macros.get(name,None)
+    r = self._macros.get(name,None)
+    if r is not None:
+      return r.decode()
+    return r
 
   def replacebody(self,chunk):
     if self._body:
diff --git a/Milter/testctx.py b/Milter/testctx.py
index 6e79807..64b20c9 100644
--- a/Milter/testctx.py
+++ b/Milter/testctx.py
@@ -65,8 +65,11 @@ class TestCtx(object):
     if stage >= 0:
       syms = self._symlist[stage]
       if syms is not None and name not in syms:
-        return syms
-    return self._macros.get(name,'notfound')
+        return None
+    r = self._macros.get(name,None)
+    if r is not None:
+      return r.decode()
+    return r
 
   def _setsymval(self,name,val):
     self._macros[name] = val
-- 
GitLab