diff options
author | Zac Medico <zmedico@gentoo.org> | 2009-09-25 06:01:56 +0000 |
---|---|---|
committer | Zac Medico <zmedico@gentoo.org> | 2009-09-25 06:01:56 +0000 |
commit | b791c4d5b78df5a8e514f5e17ea8f5faca00350c (patch) | |
tree | 0ecd1da70c01676fcd7799366bb05fec3f14729c | |
parent | a7104850eb59b65fcf3a5cd9f93d71c213c1b02e (diff) | |
download | portage-b791c4d5b78df5a8e514f5e17ea8f5faca00350c.tar.gz portage-b791c4d5b78df5a8e514f5e17ea8f5faca00350c.tar.bz2 portage-b791c4d5b78df5a8e514f5e17ea8f5faca00350c.zip |
Fix length calculation so it doesn't assume the length of the encoded
string is the same as the unicode string.
svn path=/main/trunk/; revision=14424
-rw-r--r-- | pym/portage/tests/ebuild/test_array_fromfile_eof.py | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/pym/portage/tests/ebuild/test_array_fromfile_eof.py b/pym/portage/tests/ebuild/test_array_fromfile_eof.py index 8eacb406b..eebf0234c 100644 --- a/pym/portage/tests/ebuild/test_array_fromfile_eof.py +++ b/pym/portage/tests/ebuild/test_array_fromfile_eof.py @@ -18,9 +18,10 @@ class ArrayFromfileEofTestCase(TestCase): # http://bugs.python.org/issue5334 input_data = "an arbitrary string" + input_bytes = _unicode_encode(input_data, + encoding='utf_8', errors='strict') f = tempfile.TemporaryFile() - f.write(_unicode_encode(input_data, - encoding='utf_8', errors='strict')) + f.write(input_bytes) f.seek(0) data = [] @@ -28,7 +29,7 @@ class ArrayFromfileEofTestCase(TestCase): while not eof: a = array.array('B') try: - a.fromfile(f, len(input_data) + 1) + a.fromfile(f, len(input_bytes) + 1) except EOFError: # python-3.0 lost data here eof = True |