Hi Colin, apologies for not being more exact for you in the previous email -- hopefully this makes up for it!
> > def seekable(self):
> > return True
>
> In arfile.ArMember, right?
correct -- patch attached if that helps
> > the others look like a change in the way subprocess thinks about
> > communicate() but I can't see anything in the 3.3 release notes that
> > discusses this.
>
> I think those other failures indicate that you're missing the
> python3-apt patch from #656288. Could you make sure of that? It'd be
> good to ensure that this all tests out cleanly with 3.3.
On double checking, I realise that I do not have python3-apt installed in that
chroot and that python-debian is falling back to its internal parser. I should
also reiterate that the test suite passed without issue with sid's python3
(3.2.3~rc2-1) package; the test suite failures are all in the communication
with gpg not apt.
The root of all the failures is deb822.GpgInfo.from_sequence() and its
interaction with subprocess. While the changes summary for 3.3 doesn't mention
anything about subprocess, there's a 1000 line diff between 3.2.3 and 3.3.0a4.
The key difference is that the "universal_newlines" behaviour flag now
influences
the data that is sent to stdin of the subprocess as well as the stdout/stderr
coming back. This means that the input data given to subprocess.communicate()
must be of the appropriate type:
«The type of input must be bytes or, if universal_newlines was True, a
string.»
http://docs.python.org/dev/library/subprocess.html#subprocess.Popen.communicate
My reading of this is that for python3.3, setting universal_newlines=True and
sending bytes is wrong. The attached patch turns universal_newlines off and
sends bytes in both directions. The alternative would be to leave
universal_newlines=True and fix the treatment of "inp" before passing it to
p.communicate(). I have no feeling either way other than the changes I made
looked less invasive.
(BTW if GpgInfo._get_full_string() is going to return bytes, perhaps the
method name and docstring should change -- misleading method names make bytes
vs strings even harder to track down than they otherwise should be.)
Application of the two attached patches along with your patch stack allows the
test suite to pass with both python3.2 and python3.3a4.
cheers
Stuart
--
Stuart Prescott -- www.nanonanonano.net
diff --git a/lib/debian/arfile.py b/lib/debian/arfile.py
index eea9007..545bf3f 100644
--- a/lib/debian/arfile.py
+++ b/lib/debian/arfile.py
@@ -305,6 +305,9 @@ class ArMember(object):
elif whence == 2:
self.__fp.seek(self.__end + offset, 0)
+ def seekable(self):
+ return True
+
def tell(self):
if self.__fp is None:
self.__fp = open(self.__fname, "rb")
diff --git a/lib/debian/deb822.py b/lib/debian/deb822.py
index 88ef6e1..eecc8c0 100644
--- a/lib/debian/deb822.py
+++ b/lib/debian/deb822.py
@@ -816,7 +816,7 @@ class GpgInfo(dict):
p = subprocess.Popen(args, stdin=subprocess.PIPE,
stdout=subprocess.PIPE, stderr=subprocess.PIPE,
- universal_newlines=True)
+ universal_newlines=False)
# XXX what to do with exit code?
if isinstance(sequence, bytes):
@@ -825,7 +825,8 @@ class GpgInfo(dict):
inp = cls._get_full_string(sequence)
out, err = p.communicate(inp)
- return cls.from_output(out, err)
+ return cls.from_output(str(out, encoding='utf-8'),
+ str(err, encoding='utf-8'))
@staticmethod
def _get_full_string(sequence):
signature.asc
Description: This is a digitally signed message part.

