Author: brett.cannon
Date: Thu Jul 26 05:19:46 2007
New Revision: 56549
Modified:
python/branches/py3k-struni/Lib/test/test_xdrlib.py
python/branches/py3k-struni/Lib/xdrlib.py
Log:
Move xdrlib over to the bytes type.
Modified: python/branches/py3k-struni/Lib/test/test_xdrlib.py
==============================================================================
--- python/branches/py3k-struni/Lib/test/test_xdrlib.py (original)
+++ python/branches/py3k-struni/Lib/test/test_xdrlib.py Thu Jul 26 05:19:46 2007
@@ -8,8 +8,8 @@
def test_xdr(self):
p = xdrlib.Packer()
- s = 'hello world'
- a = ['what', 'is', 'hapnin', 'doctor']
+ s = b'hello world'
+ a = [b'what', b'is', b'hapnin', b'doctor']
p.pack_int(42)
p.pack_uint(9)
Modified: python/branches/py3k-struni/Lib/xdrlib.py
==============================================================================
--- python/branches/py3k-struni/Lib/xdrlib.py (original)
+++ python/branches/py3k-struni/Lib/xdrlib.py Thu Jul 26 05:19:46 2007
@@ -5,7 +5,7 @@
"""
import struct
-from io import StringIO as _StringIO
+from io import BytesIO
__all__ = ["Error", "Packer", "Unpacker", "ConversionError"]
@@ -40,7 +40,7 @@
self.reset()
def reset(self):
- self.__buf = _StringIO()
+ self.__buf = BytesIO()
def get_buffer(self):
return self.__buf.getvalue()
@@ -54,8 +54,8 @@
pack_enum = pack_int
def pack_bool(self, x):
- if x: self.__buf.write('\0\0\0\1')
- else: self.__buf.write('\0\0\0\0')
+ if x: self.__buf.write(b'\0\0\0\1')
+ else: self.__buf.write(b'\0\0\0\0')
def pack_uhyper(self, x):
self.pack_uint(x>>32 & 0xffffffff)
@@ -78,7 +78,7 @@
raise ValueError, 'fstring size must be nonnegative'
data = s[:n]
n = ((n+3)//4)*4
- data = data + (n - len(data)) * '\0'
+ data = data + (n - len(data)) * b'\0'
self.__buf.write(data)
pack_fopaque = pack_fstring
_______________________________________________
Python-3000-checkins mailing list
[email protected]
http://mail.python.org/mailman/listinfo/python-3000-checkins