[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#743903:



On Tue, 2014-05-27 at 11:43 +0200, Didier 'OdyX' Raboud wrote:
> Nice catch, thanks. Can you suggest an alternative patch?

If the goal is that this should work on Python 3 as well then I'm afraid
not, at least not as far as this particular bug report is concerned. The
script is full of calls to iteritems() and xreadlines() for example,
which seems to indicate that nobody has ever even bothered to test on
Python 3.

Something like the following fixes things for Python 2 on jessie/sid at
least:

--- initdutils.py.orig	2014-05-28 08:23:37.526834202 +0200
+++ initdutils.py	2014-05-28 09:12:40.814008103 +0200
@@ -3,7 +3,8 @@
 # Python3-compatible print() function
 from __future__ import print_function
 
-import re, sys, os, io
+from cStringIO import StringIO
+import re, sys, os
 import pickle
 
 class RFC822Parser(dict):
@@ -19,7 +20,7 @@
         super(RFC822Parser, self).__init__(basedict)
 
         if not fileob:
-            fileob = io.StringIO(strob)
+            fileob = StringIO(strob)
 
         key = None
         for line in fileob:


Reply to: