Patch# 1258 by Christian Heimes: kill basestring.
I like this because it makes the code shorter! :-)
diff --git a/Lib/test/test___future__.py b/Lib/test/test___future__.py
index 50a2c74..9504155 100644
--- a/Lib/test/test___future__.py
+++ b/Lib/test/test___future__.py
@@ -39,7 +39,7 @@
                 a(isinstance(major, int), "%s major isn't int"  % name)
                 a(isinstance(minor, int), "%s minor isn't int" % name)
                 a(isinstance(micro, int), "%s micro isn't int" % name)
-                a(isinstance(level, basestring),
+                a(isinstance(level, str),
                     "%s level isn't string" % name)
                 a(level in GOOD_SERIALS,
                        "%s level string has unknown value" % name)
diff --git a/Lib/test/test_abc.py b/Lib/test/test_abc.py
index 008d839..e6c8415 100644
--- a/Lib/test/test_abc.py
+++ b/Lib/test/test_abc.py
@@ -81,9 +81,11 @@
         self.assertEqual(issubclass(int, A), True)
         class B(A):
             pass
-        B.register(basestring)
+        B.register(str)
+        class C(str): pass
         self.assertEqual(isinstance("", A), True)
         self.assertEqual(issubclass(str, A), True)
+        self.assertEqual(issubclass(C, A), True)
 
     def test_registration_edge_cases(self):
         class A(metaclass=abc.ABCMeta):
diff --git a/Lib/test/test_ast.py b/Lib/test/test_ast.py
index 6299123..4883ed5 100644
--- a/Lib/test/test_ast.py
+++ b/Lib/test/test_ast.py
@@ -2,7 +2,7 @@
 import _ast
 
 def to_tuple(t):
-    if t is None or isinstance(t, (basestring, int, int, complex)):
+    if t is None or isinstance(t, (str, int, complex)):
         return t
     elif isinstance(t, list):
         return [to_tuple(e) for e in t]
diff --git a/Lib/test/test_codeccallbacks.py b/Lib/test/test_codeccallbacks.py
index 6d7e98e..eedd48a 100644
--- a/Lib/test/test_codeccallbacks.py
+++ b/Lib/test/test_codeccallbacks.py
@@ -140,17 +140,17 @@
             sin += chr(sys.maxunicode)
         sout = b"a\\xac\\u1234\\u20ac\\u8000"
         if sys.maxunicode > 0xffff:
-            sout += bytes("\\U%08x" % sys.maxunicode)
+            sout += bytes("\\U%08x" % sys.maxunicode, "ascii")
         self.assertEqual(sin.encode("ascii", "backslashreplace"), sout)
 
         sout = b"a\xac\\u1234\\u20ac\\u8000"
         if sys.maxunicode > 0xffff:
-            sout += bytes("\\U%08x" % sys.maxunicode)
+            sout += bytes("\\U%08x" % sys.maxunicode, "ascii")
         self.assertEqual(sin.encode("latin-1", "backslashreplace"), sout)
 
         sout = b"a\xac\\u1234\xa4\\u8000"
         if sys.maxunicode > 0xffff:
-            sout += bytes("\\U%08x" % sys.maxunicode)
+            sout += bytes("\\U%08x" % sys.maxunicode, "ascii")
         self.assertEqual(sin.encode("iso-8859-15", "backslashreplace"), sout)
 
     def test_decoderelaxedutf8(self):
diff --git a/Lib/test/test_codecs.py b/Lib/test/test_codecs.py
index 2d531d2..22db2ca 100644
--- a/Lib/test/test_codecs.py
+++ b/Lib/test/test_codecs.py
@@ -803,8 +803,9 @@
             codecs.register_error("UnicodeInternalTest", codecs.ignore_errors)
             decoder = codecs.getdecoder("unicode_internal")
             ab = "ab".encode("unicode_internal")
-            ignored = decoder(bytes("%s\x22\x22\x22\x22%s" % (ab[:4], ab[4:])),
-                "UnicodeInternalTest")
+            ignored = decoder(bytes("%s\x22\x22\x22\x22%s" % (ab[:4], ab[4:]),
+                                    "ascii"),
+                              "UnicodeInternalTest")
             self.assertEquals(("ab", 12), ignored)
 
 # From http://www.gnu.org/software/libidn/draft-josefsson-idn-test-vectors.html
diff --git a/Lib/test/test_collections.py b/Lib/test/test_collections.py
index 24266ed..568e682 100644
--- a/Lib/test/test_collections.py
+++ b/Lib/test/test_collections.py
@@ -235,7 +235,7 @@
         for sample in [tuple, list, bytes, str]:
             self.failUnless(isinstance(sample(), Sequence))
             self.failUnless(issubclass(sample, Sequence))
-        self.failUnless(issubclass(basestring, Sequence))
+        self.failUnless(issubclass(str, Sequence))
 
     def test_MutableSequence(self):
         for sample in [tuple, str]:
@@ -244,7 +244,7 @@
         for sample in [list, bytes]:
             self.failUnless(isinstance(sample(), MutableSequence))
             self.failUnless(issubclass(sample, MutableSequence))
-        self.failIf(issubclass(basestring, MutableSequence))
+        self.failIf(issubclass(str, MutableSequence))
 
 
 def test_main(verbose=None):
diff --git a/Lib/test/test_grp.py b/Lib/test/test_grp.py
index 978dee9..24b3f00 100755
--- a/Lib/test/test_grp.py
+++ b/Lib/test/test_grp.py
@@ -11,9 +11,9 @@
         # attributes promised by the docs
         self.assertEqual(len(value), 4)
         self.assertEqual(value[0], value.gr_name)
-        self.assert_(isinstance(value.gr_name, basestring))
+        self.assert_(isinstance(value.gr_name, str))
         self.assertEqual(value[1], value.gr_passwd)
-        self.assert_(isinstance(value.gr_passwd, basestring))
+        self.assert_(isinstance(value.gr_passwd, str))
         self.assertEqual(value[2], value.gr_gid)
         self.assert_(isinstance(value.gr_gid, int))
         self.assertEqual(value[3], value.gr_mem)
diff --git a/Lib/test/test_isinstance.py b/Lib/test/test_isinstance.py
index c10fd32..1e29f4c 100644
--- a/Lib/test/test_isinstance.py
+++ b/Lib/test/test_isinstance.py
@@ -242,7 +242,7 @@
         self.assertEqual(True, issubclass(NewSuper, (NewChild, (NewSuper,))))
 
         self.assertEqual(True, issubclass(int, (int, (float, int))))
-        self.assertEqual(True, issubclass(str, (str, (Child, NewChild, basestring))))
+        self.assertEqual(True, issubclass(str, (str, (Child, NewChild, str))))
 
     def test_subclass_recursion_limit(self):
         # make sure that issubclass raises RuntimeError before the C stack is
diff --git a/Lib/test/test_posixpath.py b/Lib/test/test_posixpath.py
index 3eb981d..8c0d5ff 100644
--- a/Lib/test/test_posixpath.py
+++ b/Lib/test/test_posixpath.py
@@ -335,15 +335,15 @@
         except ImportError:
             pass
         else:
-            self.assert_(isinstance(posixpath.expanduser("~/"), basestring))
+            self.assert_(isinstance(posixpath.expanduser("~/"), str))
             # if home directory == root directory, this test makes no sense
             if posixpath.expanduser("~") != '/':
                 self.assertEqual(
                     posixpath.expanduser("~") + "/",
                     posixpath.expanduser("~/")
                 )
-            self.assert_(isinstance(posixpath.expanduser("~root/"), basestring))
-            self.assert_(isinstance(posixpath.expanduser("~foo/"), basestring))
+            self.assert_(isinstance(posixpath.expanduser("~root/"), str))
+            self.assert_(isinstance(posixpath.expanduser("~foo/"), str))
 
         self.assertRaises(TypeError, posixpath.expanduser)
 
diff --git a/Lib/test/test_pwd.py b/Lib/test/test_pwd.py
index 7abf905..358b8b3 100644
--- a/Lib/test/test_pwd.py
+++ b/Lib/test/test_pwd.py
@@ -13,19 +13,19 @@
         for e in entries:
             self.assertEqual(len(e), 7)
             self.assertEqual(e[0], e.pw_name)
-            self.assert_(isinstance(e.pw_name, basestring))
+            self.assert_(isinstance(e.pw_name, str))
             self.assertEqual(e[1], e.pw_passwd)
-            self.assert_(isinstance(e.pw_passwd, basestring))
+            self.assert_(isinstance(e.pw_passwd, str))
             self.assertEqual(e[2], e.pw_uid)
             self.assert_(isinstance(e.pw_uid, int))
             self.assertEqual(e[3], e.pw_gid)
             self.assert_(isinstance(e.pw_gid, int))
             self.assertEqual(e[4], e.pw_gecos)
-            self.assert_(isinstance(e.pw_gecos, basestring))
+            self.assert_(isinstance(e.pw_gecos, str))
             self.assertEqual(e[5], e.pw_dir)
-            self.assert_(isinstance(e.pw_dir, basestring))
+            self.assert_(isinstance(e.pw_dir, str))
             self.assertEqual(e[6], e.pw_shell)
-            self.assert_(isinstance(e.pw_shell, basestring))
+            self.assert_(isinstance(e.pw_shell, str))
 
             # The following won't work, because of duplicate entries
             # for one uid
diff --git a/Lib/test/test_re.py b/Lib/test/test_re.py
index 1ede133..f935e1d 100644
--- a/Lib/test/test_re.py
+++ b/Lib/test/test_re.py
@@ -591,9 +591,10 @@
         self.assertEqual([item.group(0) for item in iter],
                          [":", "::", ":::"])
 
-    def test_bug_926075(self):
-        self.assert_(re.compile('bug_926075') is not
-                     re.compile(str8('bug_926075')))
+    # XXX This needs to be restored for str vs. bytes.
+##     def test_bug_926075(self):
+##         self.assert_(re.compile('bug_926075') is not
+##                      re.compile(str8('bug_926075')))
 
     def test_bug_931848(self):
         pattern = eval('"[\u002E\u3002\uFF0E\uFF61]"')
diff --git a/Lib/test/test_support.py b/Lib/test/test_support.py
index 5b2176e..fb634f6 100644
--- a/Lib/test/test_support.py
+++ b/Lib/test/test_support.py
@@ -529,7 +529,7 @@
     valid_types = (unittest.TestSuite, unittest.TestCase)
     suite = unittest.TestSuite()
     for cls in classes:
-        if isinstance(cls, basestring):
+        if isinstance(cls, str):
             if cls in sys.modules:
                 suite.addTest(unittest.findTestCases(sys.modules[cls]))
             else:
diff --git a/Lib/test/test_sys.py b/Lib/test/test_sys.py
index e737047..ddf1876 100644
--- a/Lib/test/test_sys.py
+++ b/Lib/test/test_sys.py
@@ -126,7 +126,7 @@
     def test_getdefaultencoding(self):
         self.assertRaises(TypeError, sys.getdefaultencoding, 42)
         # can't check more than the type, as the user might have changed it
-        self.assert_(isinstance(sys.getdefaultencoding(), basestring))
+        self.assert_(isinstance(sys.getdefaultencoding(), str))
 
     # testing sys.settrace() is done in test_trace.py
     # testing sys.setprofile() is done in test_profile.py
@@ -275,15 +275,15 @@
         self.assert_(isinstance(sys.argv, list))
         self.assert_(sys.byteorder in ("little", "big"))
         self.assert_(isinstance(sys.builtin_module_names, tuple))
-        self.assert_(isinstance(sys.copyright, basestring))
-        self.assert_(isinstance(sys.exec_prefix, basestring))
-        self.assert_(isinstance(sys.executable, basestring))
+        self.assert_(isinstance(sys.copyright, str))
+        self.assert_(isinstance(sys.exec_prefix, str))
+        self.assert_(isinstance(sys.executable, str))
         self.assert_(isinstance(sys.hexversion, int))
         self.assert_(isinstance(sys.maxint, int))
         self.assert_(isinstance(sys.maxunicode, int))
-        self.assert_(isinstance(sys.platform, basestring))
-        self.assert_(isinstance(sys.prefix, basestring))
-        self.assert_(isinstance(sys.version, basestring))
+        self.assert_(isinstance(sys.platform, str))
+        self.assert_(isinstance(sys.prefix, str))
+        self.assert_(isinstance(sys.version, str))
         vi = sys.version_info
         self.assert_(isinstance(vi, tuple))
         self.assertEqual(len(vi), 5)
diff --git a/Lib/test/test_tempfile.py b/Lib/test/test_tempfile.py
index 3e4f803..8d91927 100644
--- a/Lib/test/test_tempfile.py
+++ b/Lib/test/test_tempfile.py
@@ -143,7 +143,7 @@
 
         self.failIf(len(cand) == 0)
         for c in cand:
-            self.assert_(isinstance(c, basestring),
+            self.assert_(isinstance(c, str),
                          "%s is not a string" % c)
 
     def test_wanted_dirs(self):
@@ -328,7 +328,7 @@
         # gettempprefix returns a nonempty prefix string
         p = tempfile.gettempprefix()
 
-        self.assert_(isinstance(p, basestring))
+        self.assert_(isinstance(p, str))
         self.assert_(len(p) > 0)
 
     def test_usable_template(self):
@@ -463,7 +463,7 @@
                 extant[i] = self.do_create(pre="aa")
         finally:
             for i in extant:
-                if(isinstance(i, basestring)):
+                if(isinstance(i, str)):
                     os.rmdir(i)
 
     def test_choose_directory(self):
diff --git a/Lib/test/test_textwrap.py b/Lib/test/test_textwrap.py
index 89316bc..b226c71 100644
--- a/Lib/test/test_textwrap.py
+++ b/Lib/test/test_textwrap.py
@@ -23,7 +23,7 @@
             for i in range(len(textin)):
                 result.append("  %d: %r" % (i, textin[i]))
             result = '\n'.join(result)
-        elif isinstance(textin, basestring):
+        elif isinstance(textin, str):
             result = "  %s\n" % repr(textin)
         return result
 
diff --git a/Lib/test/test_unittest.py b/Lib/test/test_unittest.py
index 9b43f45..eac8074 100644
--- a/Lib/test/test_unittest.py
+++ b/Lib/test/test_unittest.py
@@ -1718,7 +1718,7 @@
     def test_id(self):
         test = unittest.FunctionTestCase(lambda: None)
 
-        self.failUnless(isinstance(test.id(), basestring))
+        self.failUnless(isinstance(test.id(), str))
 
     # "Returns a one-line description of the test, or None if no description
     # has been provided. The default implementation of this method returns
@@ -2239,7 +2239,7 @@
             def runTest(self):
                 pass
 
-        self.failUnless(isinstance(Foo().id(), basestring))
+        self.failUnless(isinstance(Foo().id(), str))
 
     # "Returns a one-line description of the test, or None if no description
     # has been provided. The default implementation of this method returns