From afb29c85fac4740a18ca67add8fee31a93e30739 Mon Sep 17 00:00:00 2001 From: John Ehresman Date: Thu, 15 Apr 2010 18:08:38 -0400 Subject: A working _bytes for python 3k --- tests/common.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/tests/common.py b/tests/common.py index bd7951c..5222230 100644 --- a/tests/common.py +++ b/tests/common.py @@ -49,9 +49,10 @@ def importModule(module, directory, name=None): module, expected, current)) return obj -try: - _bytes = bytes -except NameError: +if sys.version_info >= (3, 0): + def _bytes(s): + return s.encode('latin1') +else: _bytes = str try: -- cgit