[pygobject/py3k] A working _bytes for python 3k
- From: John Ehresman <jpe src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [pygobject/py3k] A working _bytes for python 3k
- Date: Thu, 15 Apr 2010 22:09:22 +0000 (UTC)
commit ddfb1653c40ff06c9ff2cb5b2fac22fcaa645efe
Author: John Ehresman <jpe wingware com>
Date: Thu Apr 15 18:08:38 2010 -0400
A working _bytes for python 3k
tests/common.py | 7 ++++---
1 files 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:
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]