From a06c93d6e7e6c97a7a3da60e160f6c63e9a6e25c Mon Sep 17 00:00:00 2001 From: Isis Lovecruft Date: Thu, 19 Mar 2015 00:07:19 +0000 Subject: [PATCH] Fix switched b() functions. * FIXES mistake from commit 16107bc8a8be14bb8fedbf2a2eeea879d5f737c5 --- gnupg/_util.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/gnupg/_util.py b/gnupg/_util.py index d25aa92..15b0b77 100644 --- a/gnupg/_util.py +++ b/gnupg/_util.py @@ -169,7 +169,11 @@ def find_encodings(enc=None, system=False): if _py3k: def b(x): """See http://python3porting.com/problems.html#nicer-solutions""" - return x + coder = find_encodings() + if isinstance(x, bytes): + return coder.encode(x.decode(coder.name))[0] + else: + return coder.encode(x)[0] def s(x): if isinstance(x, str): @@ -181,7 +185,7 @@ if _py3k: else: def b(x): """See http://python3porting.com/problems.html#nicer-solutions""" - return find_encodings().encode(x)[0] + return x def s(x): if isinstance(x, basestring):