Merging the py3k-pep3137 branch back into the py3k branch.
No detailed change log; just check out the change log for the py3k-pep3137
branch. The most obvious changes:
- str8 renamed to bytes (PyString at the C level);
- bytes renamed to buffer (PyBytes at the C level);
- PyString and PyUnicode are no longer compatible.
I.e. we now have an immutable bytes type and a mutable bytes type.
The behavior of PyString was modified quite a bit, to make it more
bytes-like. Some changes are still on the to-do list.
diff --git a/Lib/test/string_tests.py b/Lib/test/string_tests.py
index 9da062e..a789515 100644
--- a/Lib/test/string_tests.py
+++ b/Lib/test/string_tests.py
@@ -558,10 +558,10 @@
a = self.type2test('DNSSEC')
b = self.type2test('')
for c in a:
- # Special case for the str8, since indexing returns a integer
- # XXX Maybe it would be a good idea to seperate str8's tests...
- if self.type2test == str8:
- c = chr(c)
+## # Special case for the str8, since indexing returns a integer
+## # XXX Maybe it would be a good idea to seperate str8's tests...
+## if self.type2test == str8:
+## c = chr(c)
b += c
hash(b)
self.assertEqual(hash(a), hash(b))
@@ -992,14 +992,14 @@
self.checkequal('abc', 'a', 'join', ('abc',))
self.checkequal('z', 'a', 'join', UserList(['z']))
self.checkequal('a.b.c', '.', 'join', ['a', 'b', 'c'])
- self.checkequal('a.b.3', '.', 'join', ['a', 'b', 3])
+ self.assertRaises(TypeError, '.'.join, ['a', 'b', 3])
for i in [5, 25, 125]:
self.checkequal(((('a' * i) + '-') * i)[:-1], '-', 'join',
['a' * i] * i)
self.checkequal(((('a' * i) + '-') * i)[:-1], '-', 'join',
('a' * i,) * i)
- self.checkequal(str(BadSeq1()), ' ', 'join', BadSeq1())
+ #self.checkequal(str(BadSeq1()), ' ', 'join', BadSeq1())
self.checkequal('a b c', ' ', 'join', BadSeq2())
self.checkraises(TypeError, ' ', 'join')
@@ -1147,16 +1147,16 @@
s2 = "".join([s1])
self.assert_(s1 is s2)
- elif t is str8:
- s1 = subclass("abcd")
- s2 = "".join([s1])
- self.assert_(s1 is not s2)
- self.assert_(type(s2) is str) # promotes!
+## elif t is str8:
+## s1 = subclass("abcd")
+## s2 = "".join([s1])
+## self.assert_(s1 is not s2)
+## self.assert_(type(s2) is str) # promotes!
- s1 = t("abcd")
- s2 = "".join([s1])
- self.assert_(s1 is not s2)
- self.assert_(type(s2) is str) # promotes!
+## s1 = t("abcd")
+## s2 = "".join([s1])
+## self.assert_(s1 is not s2)
+## self.assert_(type(s2) is str) # promotes!
else:
self.fail("unexpected type for MixinStrUnicodeTest %r" % t)