[Python-3000-checkins] r58495 - in python/branches/py3k: Include/stringobject.h Lib/ConfigParser.py Lib/UserString.py Lib/_abcoll.py Lib/binhex.py Lib/cProfile.py Lib/cmd.py Lib/cookielib.py Lib/copy_reg.py Lib/decimal.py Lib/distutils/ccompiler.py Lib/distutils/cmd.py Lib/distutils/command/build_clib.py Lib/distutils/command/build_ext.py Lib/distutils/command/build_py.py Lib/distutils/command/config.py Lib/distutils/command/install.py Lib/distutils/command/install_data.py Lib/distutils/dir_util.py Lib/distutils/dist.py Lib/distutils/extension.py Lib/distutils/fancy_getopt.py Lib/distutils/filelist.py Lib/distutils/unixccompiler.py Lib/doctest.py Lib/email/feedparser.py Lib/email/generator.py Lib/email/iterators.py Lib/fileinput.py Lib/inspect.py Lib/io.py Lib/lib-tk/Tkinter.py Lib/locale.py Lib/logging/__init__.py Lib/msilib/__init__.py Lib/optparse.py Lib/os.py Lib/pickle.py Lib/pickletools.py Lib/pkgutil.py Lib/pstats.py Lib/shlex.py Lib/smtplib.py Lib/sre_compile.py Lib/subprocess.py Lib/tarfile.py Lib/test/test___future__.py Lib/test/test_abc.py Lib/test/test_ast.py Lib/test/test_codeccallbacks.py Lib/test/test_codecs.py Lib/test/test_collections.py Lib/test/test_grp.py Lib/test/test_isinstance.py Lib/test/test_posixpath.py Lib/test/test_pwd.py Lib/test/test_re.py Lib/test/test_support.py Lib/test/test_sys.py Lib/test/test_tempfile.py Lib/test/test_textwrap.py Lib/test/test_unittest.py Lib/timeit.py Lib/unittest.py Lib/urllib2.py Lib/uu.py Lib/warnings.py Lib/wave.py Lib/webbrowser.py Lib/xml/dom/pulldom.py Lib/xml/sax/saxutils.py Lib/xmlrpclib.py Lib/zipfile.py Modules/_csv.c Objects/stringobject.c Objects/unicodeobject.c Python/bltinmodule.c

guido.van.rossum python-3000-checkins at python.org
Tue Oct 16 20:13:23 CEST 2007


Author: guido.van.rossum
Date: Tue Oct 16 20:12:55 2007
New Revision: 58495

Modified:
   python/branches/py3k/Include/stringobject.h
   python/branches/py3k/Lib/ConfigParser.py
   python/branches/py3k/Lib/UserString.py
   python/branches/py3k/Lib/_abcoll.py
   python/branches/py3k/Lib/binhex.py
   python/branches/py3k/Lib/cProfile.py
   python/branches/py3k/Lib/cmd.py
   python/branches/py3k/Lib/cookielib.py
   python/branches/py3k/Lib/copy_reg.py
   python/branches/py3k/Lib/decimal.py
   python/branches/py3k/Lib/distutils/ccompiler.py
   python/branches/py3k/Lib/distutils/cmd.py
   python/branches/py3k/Lib/distutils/command/build_clib.py
   python/branches/py3k/Lib/distutils/command/build_ext.py
   python/branches/py3k/Lib/distutils/command/build_py.py
   python/branches/py3k/Lib/distutils/command/config.py
   python/branches/py3k/Lib/distutils/command/install.py
   python/branches/py3k/Lib/distutils/command/install_data.py
   python/branches/py3k/Lib/distutils/dir_util.py
   python/branches/py3k/Lib/distutils/dist.py
   python/branches/py3k/Lib/distutils/extension.py
   python/branches/py3k/Lib/distutils/fancy_getopt.py
   python/branches/py3k/Lib/distutils/filelist.py
   python/branches/py3k/Lib/distutils/unixccompiler.py
   python/branches/py3k/Lib/doctest.py
   python/branches/py3k/Lib/email/feedparser.py
   python/branches/py3k/Lib/email/generator.py
   python/branches/py3k/Lib/email/iterators.py
   python/branches/py3k/Lib/fileinput.py
   python/branches/py3k/Lib/inspect.py
   python/branches/py3k/Lib/io.py
   python/branches/py3k/Lib/lib-tk/Tkinter.py
   python/branches/py3k/Lib/locale.py
   python/branches/py3k/Lib/logging/__init__.py
   python/branches/py3k/Lib/msilib/__init__.py
   python/branches/py3k/Lib/optparse.py
   python/branches/py3k/Lib/os.py
   python/branches/py3k/Lib/pickle.py
   python/branches/py3k/Lib/pickletools.py
   python/branches/py3k/Lib/pkgutil.py
   python/branches/py3k/Lib/pstats.py
   python/branches/py3k/Lib/shlex.py
   python/branches/py3k/Lib/smtplib.py
   python/branches/py3k/Lib/sre_compile.py
   python/branches/py3k/Lib/subprocess.py
   python/branches/py3k/Lib/tarfile.py
   python/branches/py3k/Lib/test/test___future__.py
   python/branches/py3k/Lib/test/test_abc.py
   python/branches/py3k/Lib/test/test_ast.py
   python/branches/py3k/Lib/test/test_codeccallbacks.py
   python/branches/py3k/Lib/test/test_codecs.py
   python/branches/py3k/Lib/test/test_collections.py
   python/branches/py3k/Lib/test/test_grp.py
   python/branches/py3k/Lib/test/test_isinstance.py
   python/branches/py3k/Lib/test/test_posixpath.py
   python/branches/py3k/Lib/test/test_pwd.py
   python/branches/py3k/Lib/test/test_re.py
   python/branches/py3k/Lib/test/test_support.py
   python/branches/py3k/Lib/test/test_sys.py
   python/branches/py3k/Lib/test/test_tempfile.py
   python/branches/py3k/Lib/test/test_textwrap.py
   python/branches/py3k/Lib/test/test_unittest.py
   python/branches/py3k/Lib/timeit.py
   python/branches/py3k/Lib/unittest.py
   python/branches/py3k/Lib/urllib2.py
   python/branches/py3k/Lib/uu.py
   python/branches/py3k/Lib/warnings.py
   python/branches/py3k/Lib/wave.py
   python/branches/py3k/Lib/webbrowser.py
   python/branches/py3k/Lib/xml/dom/pulldom.py
   python/branches/py3k/Lib/xml/sax/saxutils.py
   python/branches/py3k/Lib/xmlrpclib.py
   python/branches/py3k/Lib/zipfile.py
   python/branches/py3k/Modules/_csv.c
   python/branches/py3k/Objects/stringobject.c
   python/branches/py3k/Objects/unicodeobject.c
   python/branches/py3k/Python/bltinmodule.c
Log:
Patch# 1258 by Christian Heimes: kill basestring.
I like this because it makes the code shorter! :-)


Modified: python/branches/py3k/Include/stringobject.h
==============================================================================
--- python/branches/py3k/Include/stringobject.h	(original)
+++ python/branches/py3k/Include/stringobject.h	Tue Oct 16 20:12:55 2007
@@ -48,7 +48,6 @@
      */
 } PyStringObject;
 
-PyAPI_DATA(PyTypeObject) PyBaseString_Type;
 PyAPI_DATA(PyTypeObject) PyString_Type;
 
 #define PyString_Check(op) \

Modified: python/branches/py3k/Lib/ConfigParser.py
==============================================================================
--- python/branches/py3k/Lib/ConfigParser.py	(original)
+++ python/branches/py3k/Lib/ConfigParser.py	Tue Oct 16 20:12:55 2007
@@ -271,7 +271,7 @@
 
         Return list of successfully read files.
         """
-        if isinstance(filenames, basestring):
+        if isinstance(filenames, str):
             filenames = [filenames]
         read_ok = []
         for filename in filenames:
@@ -652,7 +652,7 @@
 
     def set(self, section, option, value):
         """Set an option.  Extend ConfigParser.set: check for string values."""
-        if not isinstance(value, basestring):
+        if not isinstance(value, str):
             raise TypeError("option values must be strings")
         # check for bad percent signs:
         # first, replace all "good" interpolations

Modified: python/branches/py3k/Lib/UserString.py
==============================================================================
--- python/branches/py3k/Lib/UserString.py	(original)
+++ python/branches/py3k/Lib/UserString.py	Tue Oct 16 20:12:55 2007
@@ -11,7 +11,7 @@
 
 class UserString:
     def __init__(self, seq):
-        if isinstance(seq, basestring):
+        if isinstance(seq, str):
             self.data = seq
         elif isinstance(seq, UserString):
             self.data = seq.data[:]
@@ -66,12 +66,12 @@
     def __add__(self, other):
         if isinstance(other, UserString):
             return self.__class__(self.data + other.data)
-        elif isinstance(other, basestring):
+        elif isinstance(other, str):
             return self.__class__(self.data + other)
         else:
             return self.__class__(self.data + str(other))
     def __radd__(self, other):
-        if isinstance(other, basestring):
+        if isinstance(other, str):
             return self.__class__(other + self.data)
         else:
             return self.__class__(str(other) + self.data)
@@ -184,7 +184,7 @@
         if isinstance(index, slice):
             if isinstance(sub, UserString):
                 sub = sub.data
-            elif not isinstance(sub, basestring):
+            elif not isinstance(sub, str):
                 sub = str(sub)
             start, stop, step = index.indices(len(self.data))
             if step == -1:
@@ -221,7 +221,7 @@
     def __iadd__(self, other):
         if isinstance(other, UserString):
             self.data += other.data
-        elif isinstance(other, basestring):
+        elif isinstance(other, str):
             self.data += other
         else:
             self.data += str(other)

Modified: python/branches/py3k/Lib/_abcoll.py
==============================================================================
--- python/branches/py3k/Lib/_abcoll.py	(original)
+++ python/branches/py3k/Lib/_abcoll.py	Tue Oct 16 20:12:55 2007
@@ -490,7 +490,8 @@
         return sum(1 for v in self if v == value)
 
 Sequence.register(tuple)
-Sequence.register(basestring)
+Sequence.register(str)
+Sequence.register(str8)
 Sequence.register(memoryview)
 
 

Modified: python/branches/py3k/Lib/binhex.py
==============================================================================
--- python/branches/py3k/Lib/binhex.py	(original)
+++ python/branches/py3k/Lib/binhex.py	Tue Oct 16 20:12:55 2007
@@ -169,7 +169,7 @@
 class BinHex:
     def __init__(self, name_finfo_dlen_rlen, ofp):
         name, finfo, dlen, rlen = name_finfo_dlen_rlen
-        if isinstance(ofp, basestring):
+        if isinstance(ofp, str):
             ofname = ofp
             ofp = io.open(ofname, 'wb')
             if os.name == 'mac':
@@ -371,7 +371,7 @@
 
 class HexBin:
     def __init__(self, ifp):
-        if isinstance(ifp, basestring):
+        if isinstance(ifp, str):
             ifp = io.open(ifp, 'rb')
         #
         # Find initial colon.

Modified: python/branches/py3k/Lib/cProfile.py
==============================================================================
--- python/branches/py3k/Lib/cProfile.py	(original)
+++ python/branches/py3k/Lib/cProfile.py	Tue Oct 16 20:12:55 2007
@@ -153,7 +153,7 @@
 # ____________________________________________________________
 
 def label(code):
-    if isinstance(code, basestring):
+    if isinstance(code, str):
         return ('~', 0, code)    # built-in functions ('~' sorts at the end)
     else:
         return (code.co_filename, code.co_firstlineno, code.co_name)

Modified: python/branches/py3k/Lib/cmd.py
==============================================================================
--- python/branches/py3k/Lib/cmd.py	(original)
+++ python/branches/py3k/Lib/cmd.py	Tue Oct 16 20:12:55 2007
@@ -356,7 +356,7 @@
             return
 
         nonstrings = [i for i in range(len(list))
-                        if not isinstance(list[i], basestring)]
+                        if not isinstance(list[i], str)]
         if nonstrings:
             raise TypeError("list[i] not a string for i in %s"
                             % ", ".join(map(str, nonstrings)))

Modified: python/branches/py3k/Lib/cookielib.py
==============================================================================
--- python/branches/py3k/Lib/cookielib.py	(original)
+++ python/branches/py3k/Lib/cookielib.py	Tue Oct 16 20:12:55 2007
@@ -367,7 +367,7 @@
     [[('Basic', None), ('realm', '"foobar"')]]
 
     """
-    assert not isinstance(header_values, basestring)
+    assert not isinstance(header_values, str)
     result = []
     for text in header_values:
         orig_text = text

Modified: python/branches/py3k/Lib/copy_reg.py
==============================================================================
--- python/branches/py3k/Lib/copy_reg.py	(original)
+++ python/branches/py3k/Lib/copy_reg.py	Tue Oct 16 20:12:55 2007
@@ -114,7 +114,7 @@
             if "__slots__" in c.__dict__:
                 slots = c.__dict__['__slots__']
                 # if class has a single slot, it can be given as a string
-                if isinstance(slots, basestring):
+                if isinstance(slots, str):
                     slots = (slots,)
                 for name in slots:
                     # special descriptors

Modified: python/branches/py3k/Lib/decimal.py
==============================================================================
--- python/branches/py3k/Lib/decimal.py	(original)
+++ python/branches/py3k/Lib/decimal.py	Tue Oct 16 20:12:55 2007
@@ -588,7 +588,7 @@
 
         # From a string
         # REs insist on real strings, so we can too.
-        if isinstance(value, basestring):
+        if isinstance(value, str):
             if _isinfinity(value):
                 self._exp = 'F'
                 self._int = (0,)

Modified: python/branches/py3k/Lib/distutils/ccompiler.py
==============================================================================
--- python/branches/py3k/Lib/distutils/ccompiler.py	(original)
+++ python/branches/py3k/Lib/distutils/ccompiler.py	Tue Oct 16 20:12:55 2007
@@ -154,7 +154,7 @@
             self.set_executable(key, value)
 
     def set_executable(self, key, value):
-        if isinstance(value, basestring):
+        if isinstance(value, str):
             setattr(self, key, split_quoted(value))
         else:
             setattr(self, key, value)
@@ -175,8 +175,8 @@
         for defn in definitions:
             if not (isinstance(defn, tuple) and
                     (len(defn) in (1, 2) and
-                      (isinstance (defn[1], basestring) or defn[1] is None)) and
-                    isinstance (defn[0], basestring)):
+                      (isinstance (defn[1], str) or defn[1] is None)) and
+                    isinstance (defn[0], str)):
                 raise TypeError(("invalid macro definition '%s': " % defn) + \
                       "must be tuple (string,), (string, string), or " + \
                       "(string, None)")
@@ -318,7 +318,7 @@
         """
         if outdir is None:
             outdir = self.output_dir
-        elif not isinstance(outdir, basestring):
+        elif not isinstance(outdir, str):
             raise TypeError("'output_dir' must be a string or None")
 
         if macros is None:
@@ -415,7 +415,7 @@
         """
         if output_dir is None:
             output_dir = self.output_dir
-        elif not isinstance(output_dir, basestring):
+        elif not isinstance(output_dir, str):
             raise TypeError("'output_dir' must be a string or None")
 
         if macros is None:
@@ -494,7 +494,7 @@
 
         if output_dir is None:
             output_dir = self.output_dir
-        elif not isinstance(output_dir, basestring):
+        elif not isinstance(output_dir, str):
             raise TypeError("'output_dir' must be a string or None")
 
         return (objects, output_dir)

Modified: python/branches/py3k/Lib/distutils/cmd.py
==============================================================================
--- python/branches/py3k/Lib/distutils/cmd.py	(original)
+++ python/branches/py3k/Lib/distutils/cmd.py	Tue Oct 16 20:12:55 2007
@@ -213,7 +213,7 @@
         if val is None:
             setattr(self, option, default)
             return default
-        elif not isinstance(val, basestring):
+        elif not isinstance(val, str):
             raise DistutilsOptionError("'%s' must be a %s (got `%s`)"
                                        % (option, what, val))
         return val
@@ -233,11 +233,11 @@
         val = getattr(self, option)
         if val is None:
             return
-        elif isinstance(val, basestring):
+        elif isinstance(val, str):
             setattr(self, option, re.split(r',\s*|\s+', val))
         else:
             if isinstance(val, list):
-                ok = all(isinstance(v, basestring) for v in val)
+                ok = all(isinstance(v, str) for v in val)
             else:
                 ok = False
             if not ok:
@@ -390,7 +390,7 @@
 
 
         # Allow 'infiles' to be a single string
-        if isinstance(infiles, basestring):
+        if isinstance(infiles, str):
             infiles = (infiles,)
         elif not isinstance(infiles, (list, tuple)):
             raise TypeError(

Modified: python/branches/py3k/Lib/distutils/command/build_clib.py
==============================================================================
--- python/branches/py3k/Lib/distutils/command/build_clib.py	(original)
+++ python/branches/py3k/Lib/distutils/command/build_clib.py	Tue Oct 16 20:12:55 2007
@@ -86,7 +86,7 @@
 
         if self.include_dirs is None:
             self.include_dirs = self.distribution.include_dirs or []
-        if isinstance(self.include_dirs, basestring):
+        if isinstance(self.include_dirs, str):
             self.include_dirs = self.include_dirs.split(os.pathsep)
 
         # XXX same as for build_ext -- what about 'self.define' and
@@ -134,7 +134,7 @@
                 raise DistutilsSetupError(
                       "each element of 'libraries' must a 2-tuple")
 
-            if isinstance(lib[0], basestring):
+            if isinstance(lib[0], str):
                 raise DistutilsSetupError(
                       "first element of each tuple in 'libraries' "
                       "must be a string (the library name)")

Modified: python/branches/py3k/Lib/distutils/command/build_ext.py
==============================================================================
--- python/branches/py3k/Lib/distutils/command/build_ext.py	(original)
+++ python/branches/py3k/Lib/distutils/command/build_ext.py	Tue Oct 16 20:12:55 2007
@@ -133,7 +133,7 @@
         plat_py_include = sysconfig.get_python_inc(plat_specific=1)
         if self.include_dirs is None:
             self.include_dirs = self.distribution.include_dirs or []
-        if isinstance(self.include_dirs, basestring):
+        if isinstance(self.include_dirs, str):
             self.include_dirs = self.include_dirs.split(os.pathsep)
 
         # Put the Python "system" include dir at the end, so that
@@ -142,7 +142,7 @@
         if plat_py_include != py_include:
             self.include_dirs.append(plat_py_include)
 
-        if isinstance(self.libraries, basestring):
+        if isinstance(self.libraries, str):
             self.libraries = [self.libraries]
 
         # Life is easier if we're not forever checking for None, so
@@ -151,12 +151,12 @@
             self.libraries = []
         if self.library_dirs is None:
             self.library_dirs = []
-        elif isinstance(self.library_dirs, basestring):
+        elif isinstance(self.library_dirs, str):
             self.library_dirs = self.library_dirs.split(os.pathsep)
 
         if self.rpath is None:
             self.rpath = []
-        elif isinstance(self.rpath, basestring):
+        elif isinstance(self.rpath, str):
             self.rpath = self.rpath.split(os.pathsep)
 
         # for extensions under windows use different directories
@@ -309,7 +309,7 @@
                        "each element of 'ext_modules' option must be an "
                        "Extension instance or 2-tuple")
 
-            if not (isinstance(ext_name, basestring) and
+            if not (isinstance(ext_name, str) and
                     extension_name_re.match(ext_name)):
                 raise DistutilsSetupError(
                        "first element of each tuple in 'ext_modules' "

Modified: python/branches/py3k/Lib/distutils/command/build_py.py
==============================================================================
--- python/branches/py3k/Lib/distutils/command/build_py.py	(original)
+++ python/branches/py3k/Lib/distutils/command/build_py.py	Tue Oct 16 20:12:55 2007
@@ -325,7 +325,7 @@
         return outputs
 
     def build_module(self, module, module_file, package):
-        if isinstance(package, basestring):
+        if isinstance(package, str):
             package = package.split('.')
         elif not isinstance(package, (list, tuple)):
             raise TypeError(

Modified: python/branches/py3k/Lib/distutils/command/config.py
==============================================================================
--- python/branches/py3k/Lib/distutils/command/config.py	(original)
+++ python/branches/py3k/Lib/distutils/command/config.py	Tue Oct 16 20:12:55 2007
@@ -69,17 +69,17 @@
     def finalize_options(self):
         if self.include_dirs is None:
             self.include_dirs = self.distribution.include_dirs or []
-        elif isinstance(self.include_dirs, basestring):
+        elif isinstance(self.include_dirs, str):
             self.include_dirs = self.include_dirs.split(os.pathsep)
 
         if self.libraries is None:
             self.libraries = []
-        elif isinstance(self.libraries, basestring):
+        elif isinstance(self.libraries, str):
             self.libraries = [self.libraries]
 
         if self.library_dirs is None:
             self.library_dirs = []
-        elif isinstance(self.library_dirs, basestring):
+        elif isinstance(self.library_dirs, str):
             self.library_dirs = self.library_dirs.split(os.pathsep)
 
     def run(self):
@@ -204,7 +204,7 @@
         self._check_compiler()
         (src, out) = self._preprocess(body, headers, include_dirs, lang)
 
-        if isinstance(pattern, basestring):
+        if isinstance(pattern, str):
             pattern = re.compile(pattern)
 
         file = open(out)

Modified: python/branches/py3k/Lib/distutils/command/install.py
==============================================================================
--- python/branches/py3k/Lib/distutils/command/install.py	(original)
+++ python/branches/py3k/Lib/distutils/command/install.py	Tue Oct 16 20:12:55 2007
@@ -449,7 +449,7 @@
             self.extra_path = self.distribution.extra_path
 
         if self.extra_path is not None:
-            if isinstance(self.extra_path, basestring):
+            if isinstance(self.extra_path, str):
                 self.extra_path = self.extra_path.split(',')
 
             if len(self.extra_path) == 1:

Modified: python/branches/py3k/Lib/distutils/command/install_data.py
==============================================================================
--- python/branches/py3k/Lib/distutils/command/install_data.py	(original)
+++ python/branches/py3k/Lib/distutils/command/install_data.py	Tue Oct 16 20:12:55 2007
@@ -45,7 +45,7 @@
     def run(self):
         self.mkpath(self.install_dir)
         for f in self.data_files:
-            if isinstance(f, basestring):
+            if isinstance(f, str):
                 # it's a simple file, so copy it
                 f = convert_path(f)
                 if self.warn_dir:

Modified: python/branches/py3k/Lib/distutils/dir_util.py
==============================================================================
--- python/branches/py3k/Lib/distutils/dir_util.py	(original)
+++ python/branches/py3k/Lib/distutils/dir_util.py	Tue Oct 16 20:12:55 2007
@@ -28,7 +28,7 @@
     global _path_created
 
     # Detect a common bug -- name is None
-    if not isinstance(name, basestring):
+    if not isinstance(name, str):
         raise DistutilsInternalError(
               "mkpath: 'name' must be a string (got %r)" % (name,))
 

Modified: python/branches/py3k/Lib/distutils/dist.py
==============================================================================
--- python/branches/py3k/Lib/distutils/dist.py	(original)
+++ python/branches/py3k/Lib/distutils/dist.py	Tue Oct 16 20:12:55 2007
@@ -580,13 +580,13 @@
 
         keywords = self.metadata.keywords
         if keywords is not None:
-            if isinstance(keywords, basestring):
+            if isinstance(keywords, str):
                 keywordlist = keywords.split(',')
                 self.metadata.keywords = [x.strip() for x in keywordlist]
 
         platforms = self.metadata.platforms
         if platforms is not None:
-            if isinstance(platforms, basestring):
+            if isinstance(platforms, str):
                 platformlist = platforms.split(',')
                 self.metadata.platforms = [x.strip() for x in platformlist]
 
@@ -874,7 +874,7 @@
                 neg_opt = {}
 
             try:
-                is_string = isinstance(value, basestring)
+                is_string = isinstance(value, str)
                 if option in neg_opt and is_string:
                     setattr(command_obj, neg_opt[option], not strtobool(value))
                 elif option in bool_opts and is_string:

Modified: python/branches/py3k/Lib/distutils/extension.py
==============================================================================
--- python/branches/py3k/Lib/distutils/extension.py	(original)
+++ python/branches/py3k/Lib/distutils/extension.py	Tue Oct 16 20:12:55 2007
@@ -102,9 +102,9 @@
                   language=None,
                   **kw                      # To catch unknown keywords
                  ):
-        assert isinstance(name, basestring), "'name' must be a string"
+        assert isinstance(name, str), "'name' must be a string"
         assert (isinstance(sources, list) and
-                all(isinstance(v, basestring) for v in sources)), \
+                all(isinstance(v, str) for v in sources)), \
                 "'sources' must be a list of strings"
 
         self.name = name

Modified: python/branches/py3k/Lib/distutils/fancy_getopt.py
==============================================================================
--- python/branches/py3k/Lib/distutils/fancy_getopt.py	(original)
+++ python/branches/py3k/Lib/distutils/fancy_getopt.py	Tue Oct 16 20:12:55 2007
@@ -154,12 +154,12 @@
                 raise ValueError("invalid option tuple: %r" % (option,))
 
             # Type- and value-check the option names
-            if not isinstance(long, basestring) or len(long) < 2:
+            if not isinstance(long, str) or len(long) < 2:
                 raise DistutilsGetoptError(("invalid long option '%s': "
                        "must be a string of length >= 2") % long)
 
             if (not ((short is None) or
-                     (isinstance(short, basestring) and len(short) == 1))):
+                     (isinstance(short, str) and len(short) == 1))):
                 raise DistutilsGetoptError("invalid short option '%s': "
                        "must a single character or None" % short)
 

Modified: python/branches/py3k/Lib/distutils/filelist.py
==============================================================================
--- python/branches/py3k/Lib/distutils/filelist.py	(original)
+++ python/branches/py3k/Lib/distutils/filelist.py	Tue Oct 16 20:12:55 2007
@@ -301,7 +301,7 @@
     or just returned as-is (assumes it's a regex object).
     """
     if is_regex:
-        if isinstance(pattern, basestring):
+        if isinstance(pattern, str):
             return re.compile(pattern)
         else:
             return pattern

Modified: python/branches/py3k/Lib/distutils/unixccompiler.py
==============================================================================
--- python/branches/py3k/Lib/distutils/unixccompiler.py	(original)
+++ python/branches/py3k/Lib/distutils/unixccompiler.py	Tue Oct 16 20:12:55 2007
@@ -211,7 +211,7 @@
 
         lib_opts = gen_lib_options(self, library_dirs, runtime_library_dirs,
                                    libraries)
-        if not isinstance(output_dir, (basestring, type(None))):
+        if not isinstance(output_dir, (str, type(None))):
             raise TypeError("'output_dir' must be a string or None")
         if output_dir is not None:
             output_filename = os.path.join(output_dir, output_filename)

Modified: python/branches/py3k/Lib/doctest.py
==============================================================================
--- python/branches/py3k/Lib/doctest.py	(original)
+++ python/branches/py3k/Lib/doctest.py	Tue Oct 16 20:12:55 2007
@@ -443,7 +443,7 @@
         Create a new DocTest containing the given examples.  The
         DocTest's globals are initialized with a copy of `globs`.
         """
-        assert not isinstance(examples, basestring), \
+        assert not isinstance(examples, str), \
                "DocTest no longer accepts str; use DocTestParser instead"
         self.examples = examples
         self.docstring = docstring
@@ -875,13 +875,13 @@
         # Look for tests in a module's __test__ dictionary.
         if inspect.ismodule(obj) and self._recurse:
             for valname, val in getattr(obj, '__test__', {}).items():
-                if not isinstance(valname, basestring):
+                if not isinstance(valname, str):
                     raise ValueError("DocTestFinder.find: __test__ keys "
                                      "must be strings: %r" %
                                      (type(valname),))
                 if not (inspect.isfunction(val) or inspect.isclass(val) or
                         inspect.ismethod(val) or inspect.ismodule(val) or
-                        isinstance(val, basestring)):
+                        isinstance(val, str)):
                     raise ValueError("DocTestFinder.find: __test__ values "
                                      "must be strings, functions, methods, "
                                      "classes, or modules: %r" %
@@ -914,7 +914,7 @@
         """
         # Extract the object's docstring.  If it doesn't have one,
         # then return None (no test for this object).
-        if isinstance(obj, basestring):
+        if isinstance(obj, str):
             docstring = obj
         else:
             try:
@@ -922,7 +922,7 @@
                     docstring = ''
                 else:
                     docstring = obj.__doc__
-                    if not isinstance(docstring, basestring):
+                    if not isinstance(docstring, str):
                         docstring = str(docstring)
             except (TypeError, AttributeError):
                 docstring = ''

Modified: python/branches/py3k/Lib/email/feedparser.py
==============================================================================
--- python/branches/py3k/Lib/email/feedparser.py	(original)
+++ python/branches/py3k/Lib/email/feedparser.py	Tue Oct 16 20:12:55 2007
@@ -365,7 +365,7 @@
                                 self._last.epilogue = epilogue[:-end]
                     else:
                         payload = self._last.get_payload()
-                        if isinstance(payload, basestring):
+                        if isinstance(payload, str):
                             mo = NLCRE_eol.search(payload)
                             if mo:
                                 payload = payload[:-len(mo.group(0))]

Modified: python/branches/py3k/Lib/email/generator.py
==============================================================================
--- python/branches/py3k/Lib/email/generator.py	(original)
+++ python/branches/py3k/Lib/email/generator.py	Tue Oct 16 20:12:55 2007
@@ -151,7 +151,7 @@
         payload = msg.get_payload()
         if payload is None:
             return
-        if not isinstance(payload, basestring):
+        if not isinstance(payload, str):
             raise TypeError('string payload expected: %s' % type(payload))
         if self._mangle_from_:
             payload = fcre.sub('>From ', payload)
@@ -168,7 +168,7 @@
         subparts = msg.get_payload()
         if subparts is None:
             subparts = []
-        elif isinstance(subparts, basestring):
+        elif isinstance(subparts, str):
             # e.g. a non-strict parse of a message with no starting boundary.
             self._fp.write(subparts)
             return
@@ -288,7 +288,7 @@
         for part in msg.walk():
             maintype = part.get_content_maintype()
             if maintype == 'text':
-                print(part.get_payload(decode=True), file=self)
+                print(part.get_payload(decode=False), file=self)
             elif maintype == 'multipart':
                 # Just skip this
                 pass

Modified: python/branches/py3k/Lib/email/iterators.py
==============================================================================
--- python/branches/py3k/Lib/email/iterators.py	(original)
+++ python/branches/py3k/Lib/email/iterators.py	Tue Oct 16 20:12:55 2007
@@ -39,7 +39,7 @@
     """
     for subpart in msg.walk():
         payload = subpart.get_payload(decode=decode)
-        if isinstance(payload, basestring):
+        if isinstance(payload, str):
             for line in StringIO(payload):
                 yield line
 

Modified: python/branches/py3k/Lib/fileinput.py
==============================================================================
--- python/branches/py3k/Lib/fileinput.py	(original)
+++ python/branches/py3k/Lib/fileinput.py	Tue Oct 16 20:12:55 2007
@@ -196,7 +196,7 @@
 
     def __init__(self, files=None, inplace=0, backup="", bufsize=0,
                  mode="r", openhook=None):
-        if isinstance(files, basestring):
+        if isinstance(files, str):
             files = (files,)
         else:
             if files is None:

Modified: python/branches/py3k/Lib/inspect.py
==============================================================================
--- python/branches/py3k/Lib/inspect.py	(original)
+++ python/branches/py3k/Lib/inspect.py	Tue Oct 16 20:12:55 2007
@@ -313,7 +313,7 @@
         doc = object.__doc__
     except AttributeError:
         return None
-    if not isinstance(doc, basestring):
+    if not isinstance(doc, str):
         return None
     try:
         lines = doc.expandtabs().split('\n')

Modified: python/branches/py3k/Lib/io.py
==============================================================================
--- python/branches/py3k/Lib/io.py	(original)
+++ python/branches/py3k/Lib/io.py	Tue Oct 16 20:12:55 2007
@@ -103,13 +103,13 @@
       binary stream, a buffered binary stream, or a buffered text
       stream, open for reading and/or writing.
     """
-    if not isinstance(file, (basestring, int)):
+    if not isinstance(file, (str, int)):
         raise TypeError("invalid file: %r" % file)
-    if not isinstance(mode, basestring):
+    if not isinstance(mode, str):
         raise TypeError("invalid mode: %r" % mode)
     if buffering is not None and not isinstance(buffering, int):
         raise TypeError("invalid buffering: %r" % buffering)
-    if encoding is not None and not isinstance(encoding, basestring):
+    if encoding is not None and not isinstance(encoding, str):
         raise TypeError("invalid encoding: %r" % encoding)
     modes = set(mode)
     if modes - set("arwb+tU") or len(mode) > len(modes):
@@ -1092,7 +1092,7 @@
     def write(self, s: str):
         if self.closed:
             raise ValueError("write to closed file")
-        if not isinstance(s, basestring):
+        if not isinstance(s, str):
             raise TypeError("can't write %s to text stream" %
                             s.__class__.__name__)
         haslf = "\n" in s
@@ -1394,7 +1394,7 @@
                                        encoding=encoding,
                                        newline=newline)
         if initial_value:
-            if not isinstance(initial_value, basestring):
+            if not isinstance(initial_value, str):
                 initial_value = str(initial_value)
             self.write(initial_value)
             self.seek(0)

Modified: python/branches/py3k/Lib/lib-tk/Tkinter.py
==============================================================================
--- python/branches/py3k/Lib/lib-tk/Tkinter.py	(original)
+++ python/branches/py3k/Lib/lib-tk/Tkinter.py	Tue Oct 16 20:12:55 2007
@@ -255,7 +255,7 @@
     def get(self):
         """Return value of variable as string."""
         value = self._tk.globalgetvar(self._name)
-        if isinstance(value, basestring):
+        if isinstance(value, str):
             return value
         return str(value)
 

Modified: python/branches/py3k/Lib/locale.py
==============================================================================
--- python/branches/py3k/Lib/locale.py	(original)
+++ python/branches/py3k/Lib/locale.py	Tue Oct 16 20:12:55 2007
@@ -12,6 +12,7 @@
 """
 
 import sys, encodings, encodings.aliases
+from __builtin__ import str as _builtin_str
 
 # Try importing the _locale module.
 #
@@ -472,7 +473,7 @@
         category may be given as one of the LC_* values.
 
     """
-    if locale and not isinstance(locale, basestring):
+    if locale and not isinstance(locale, _builtin_str):
         # convert to string
         locale = normalize(_build_localename(locale))
     return _setlocale(category, locale)

Modified: python/branches/py3k/Lib/logging/__init__.py
==============================================================================
--- python/branches/py3k/Lib/logging/__init__.py	(original)
+++ python/branches/py3k/Lib/logging/__init__.py	Tue Oct 16 20:12:55 2007
@@ -281,7 +281,7 @@
             msg = str(self.msg)
         else:
             msg = self.msg
-            if not isinstance(msg, basestring):
+            if not isinstance(msg, str):
                 try:
                     msg = str(self.msg)
                 except UnicodeError:

Modified: python/branches/py3k/Lib/msilib/__init__.py
==============================================================================
--- python/branches/py3k/Lib/msilib/__init__.py	(original)
+++ python/branches/py3k/Lib/msilib/__init__.py	Tue Oct 16 20:12:55 2007
@@ -101,7 +101,7 @@
             field = value[i]
             if isinstance(field, int):
                 r.SetInteger(i+1,field)
-            elif isinstance(field, basestring):
+            elif isinstance(field, str):
                 r.SetString(i+1,field)
             elif field is None:
                 pass

Modified: python/branches/py3k/Lib/optparse.py
==============================================================================
--- python/branches/py3k/Lib/optparse.py	(original)
+++ python/branches/py3k/Lib/optparse.py	Tue Oct 16 20:12:55 2007
@@ -815,9 +815,6 @@
 SUPPRESS_HELP = "SUPPRESS"+"HELP"
 SUPPRESS_USAGE = "SUPPRESS"+"USAGE"
 
-def isbasestring(x):
-    return isinstance(x, basestring)
-
 class Values:
 
     def __init__(self, defaults=None):
@@ -994,7 +991,7 @@
         """add_option(Option)
            add_option(opt_str, ..., kwarg=val, ...)
         """
-        if isbasestring(args[0]):
+        if isinstance(args[0], str):
             option = self.option_class(*args, **kwargs)
         elif len(args) == 1 and not kwargs:
             option = args[0]
@@ -1294,7 +1291,7 @@
         defaults = self.defaults.copy()
         for option in self._get_all_options():
             default = defaults.get(option.dest)
-            if isbasestring(default):
+            if isinstance(default, str):
                 opt_str = option.get_opt_string()
                 defaults[option.dest] = option.check_value(opt_str, default)
 
@@ -1305,7 +1302,7 @@
 
     def add_option_group(self, *args, **kwargs):
         # XXX lots of overlap with OptionContainer.add_option()
-        if isbasestring(args[0]):
+        if isinstance(args[0], str):
             group = OptionGroup(self, *args, **kwargs)
         elif len(args) == 1 and not kwargs:
             group = args[0]

Modified: python/branches/py3k/Lib/os.py
==============================================================================
--- python/branches/py3k/Lib/os.py	(original)
+++ python/branches/py3k/Lib/os.py	Tue Oct 16 20:12:55 2007
@@ -636,7 +636,7 @@
 
 # Supply os.popen()
 def popen(cmd, mode="r", buffering=None):
-    if not isinstance(cmd, basestring):
+    if not isinstance(cmd, str):
         raise TypeError("invalid cmd type (%s, expected string)" % type(cmd))
     if mode not in ("r", "w"):
         raise ValueError("invalid mode %r" % mode)

Modified: python/branches/py3k/Lib/pickle.py
==============================================================================
--- python/branches/py3k/Lib/pickle.py	(original)
+++ python/branches/py3k/Lib/pickle.py	Tue Oct 16 20:12:55 2007
@@ -307,7 +307,7 @@
                                         (t.__name__, obj))
 
         # Check for string returned by reduce(), meaning "save as global"
-        if isinstance(rv, basestring):
+        if isinstance(rv, str):
             self.save_global(obj, rv)
             return
 

Modified: python/branches/py3k/Lib/pickletools.py
==============================================================================
--- python/branches/py3k/Lib/pickletools.py	(original)
+++ python/branches/py3k/Lib/pickletools.py	Tue Oct 16 20:12:55 2007
@@ -701,7 +701,7 @@
     )
 
     def __init__(self, name, obtype, doc):
-        assert isinstance(name, basestring)
+        assert isinstance(name, str)
         self.name = name
 
         assert isinstance(obtype, type) or isinstance(obtype, tuple)
@@ -710,7 +710,7 @@
                 assert isinstance(contained, type)
         self.obtype = obtype
 
-        assert isinstance(doc, basestring)
+        assert isinstance(doc, str)
         self.doc = doc
 
     def __repr__(self):
@@ -846,10 +846,10 @@
 
     def __init__(self, name, code, arg,
                  stack_before, stack_after, proto, doc):
-        assert isinstance(name, basestring)
+        assert isinstance(name, str)
         self.name = name
 
-        assert isinstance(code, basestring)
+        assert isinstance(code, str)
         assert len(code) == 1
         self.code = code
 
@@ -869,7 +869,7 @@
         assert isinstance(proto, int) and 0 <= proto <= 2
         self.proto = proto
 
-        assert isinstance(doc, basestring)
+        assert isinstance(doc, str)
         self.doc = doc
 
 I = OpcodeInfo

Modified: python/branches/py3k/Lib/pkgutil.py
==============================================================================
--- python/branches/py3k/Lib/pkgutil.py	(original)
+++ python/branches/py3k/Lib/pkgutil.py	Tue Oct 16 20:12:55 2007
@@ -516,7 +516,7 @@
     path = path[:] # Start with a copy of the existing path
 
     for dir in sys.path:
-        if not isinstance(dir, basestring) or not os.path.isdir(dir):
+        if not isinstance(dir, str) or not os.path.isdir(dir):
             continue
         subdir = os.path.join(dir, pname)
         # XXX This may still add duplicate entries to path on

Modified: python/branches/py3k/Lib/pstats.py
==============================================================================
--- python/branches/py3k/Lib/pstats.py	(original)
+++ python/branches/py3k/Lib/pstats.py	Tue Oct 16 20:12:55 2007
@@ -116,7 +116,7 @@
 
     def load_stats(self, arg):
         if not arg:  self.stats = {}
-        elif isinstance(arg, basestring):
+        elif isinstance(arg, str):
             f = open(arg, 'rb')
             self.stats = marshal.load(f)
             f.close()

Modified: python/branches/py3k/Lib/shlex.py
==============================================================================
--- python/branches/py3k/Lib/shlex.py	(original)
+++ python/branches/py3k/Lib/shlex.py	Tue Oct 16 20:12:55 2007
@@ -18,7 +18,7 @@
 class shlex:
     "A lexical analyzer class for simple shell-like syntaxes."
     def __init__(self, instream=None, infile=None, posix=False):
-        if isinstance(instream, basestring):
+        if isinstance(instream, str):
             instream = StringIO(instream)
         if instream is not None:
             self.instream = instream
@@ -61,7 +61,7 @@
 
     def push_source(self, newstream, newfile=None):
         "Push an input source onto the lexer's input source stack."
-        if isinstance(newstream, basestring):
+        if isinstance(newstream, str):
             newstream = StringIO(newstream)
         self.filestack.appendleft((self.infile, self.instream, self.lineno))
         self.infile = newfile
@@ -247,7 +247,7 @@
         if newfile[0] == '"':
             newfile = newfile[1:-1]
         # This implements cpp-like semantics for relative-path inclusion.
-        if isinstance(self.infile, basestring) and not os.path.isabs(newfile):
+        if isinstance(self.infile, str) and not os.path.isabs(newfile):
             newfile = os.path.join(os.path.dirname(self.infile), newfile)
         return (newfile, open(newfile, "r"))
 

Modified: python/branches/py3k/Lib/smtplib.py
==============================================================================
--- python/branches/py3k/Lib/smtplib.py	(original)
+++ python/branches/py3k/Lib/smtplib.py	Tue Oct 16 20:12:55 2007
@@ -668,7 +668,7 @@
             self.rset()
             raise SMTPSenderRefused(code, resp, from_addr)
         senderrs={}
-        if isinstance(to_addrs, basestring):
+        if isinstance(to_addrs, str):
             to_addrs = [to_addrs]
         for each in to_addrs:
             (code,resp)=self.rcpt(each, rcpt_options)

Modified: python/branches/py3k/Lib/sre_compile.py
==============================================================================
--- python/branches/py3k/Lib/sre_compile.py	(original)
+++ python/branches/py3k/Lib/sre_compile.py	Tue Oct 16 20:12:55 2007
@@ -472,7 +472,7 @@
     code[skip] = len(code) - skip
 
 def isstring(obj):
-    return isinstance(obj, basestring)
+    return isinstance(obj, str)
 
 def _code(p, flags):
 

Modified: python/branches/py3k/Lib/subprocess.py
==============================================================================
--- python/branches/py3k/Lib/subprocess.py	(original)
+++ python/branches/py3k/Lib/subprocess.py	Tue Oct 16 20:12:55 2007
@@ -698,7 +698,7 @@
                            errread, errwrite):
             """Execute program (MS Windows version)"""
 
-            if not isinstance(args, basestring):
+            if not isinstance(args, str):
                 args = list2cmdline(args)
 
             # Process startup details
@@ -913,7 +913,7 @@
                            errread, errwrite):
             """Execute program (POSIX version)"""
 
-            if isinstance(args, basestring):
+            if isinstance(args, str):
                 args = [args]
             else:
                 args = list(args)

Modified: python/branches/py3k/Lib/tarfile.py
==============================================================================
--- python/branches/py3k/Lib/tarfile.py	(original)
+++ python/branches/py3k/Lib/tarfile.py	Tue Oct 16 20:12:55 2007
@@ -2041,7 +2041,7 @@
         """
         self._check("r")
 
-        if isinstance(member, basestring):
+        if isinstance(member, str):
             tarinfo = self.getmember(member)
         else:
             tarinfo = member
@@ -2077,7 +2077,7 @@
         """
         self._check("r")
 
-        if isinstance(member, basestring):
+        if isinstance(member, str):
             tarinfo = self.getmember(member)
         else:
             tarinfo = member

Modified: python/branches/py3k/Lib/test/test___future__.py
==============================================================================
--- python/branches/py3k/Lib/test/test___future__.py	(original)
+++ python/branches/py3k/Lib/test/test___future__.py	Tue Oct 16 20:12:55 2007
@@ -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)

Modified: python/branches/py3k/Lib/test/test_abc.py
==============================================================================
--- python/branches/py3k/Lib/test/test_abc.py	(original)
+++ python/branches/py3k/Lib/test/test_abc.py	Tue Oct 16 20:12:55 2007
@@ -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):

Modified: python/branches/py3k/Lib/test/test_ast.py
==============================================================================
--- python/branches/py3k/Lib/test/test_ast.py	(original)
+++ python/branches/py3k/Lib/test/test_ast.py	Tue Oct 16 20:12:55 2007
@@ -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]

Modified: python/branches/py3k/Lib/test/test_codeccallbacks.py
==============================================================================
--- python/branches/py3k/Lib/test/test_codeccallbacks.py	(original)
+++ python/branches/py3k/Lib/test/test_codeccallbacks.py	Tue Oct 16 20:12:55 2007
@@ -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):

Modified: python/branches/py3k/Lib/test/test_codecs.py
==============================================================================
--- python/branches/py3k/Lib/test/test_codecs.py	(original)
+++ python/branches/py3k/Lib/test/test_codecs.py	Tue Oct 16 20:12:55 2007
@@ -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

Modified: python/branches/py3k/Lib/test/test_collections.py
==============================================================================
--- python/branches/py3k/Lib/test/test_collections.py	(original)
+++ python/branches/py3k/Lib/test/test_collections.py	Tue Oct 16 20:12:55 2007
@@ -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):

Modified: python/branches/py3k/Lib/test/test_grp.py
==============================================================================
--- python/branches/py3k/Lib/test/test_grp.py	(original)
+++ python/branches/py3k/Lib/test/test_grp.py	Tue Oct 16 20:12:55 2007
@@ -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)

Modified: python/branches/py3k/Lib/test/test_isinstance.py
==============================================================================
--- python/branches/py3k/Lib/test/test_isinstance.py	(original)
+++ python/branches/py3k/Lib/test/test_isinstance.py	Tue Oct 16 20:12:55 2007
@@ -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

Modified: python/branches/py3k/Lib/test/test_posixpath.py
==============================================================================
--- python/branches/py3k/Lib/test/test_posixpath.py	(original)
+++ python/branches/py3k/Lib/test/test_posixpath.py	Tue Oct 16 20:12:55 2007
@@ -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)
 

Modified: python/branches/py3k/Lib/test/test_pwd.py
==============================================================================
--- python/branches/py3k/Lib/test/test_pwd.py	(original)
+++ python/branches/py3k/Lib/test/test_pwd.py	Tue Oct 16 20:12:55 2007
@@ -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

Modified: python/branches/py3k/Lib/test/test_re.py
==============================================================================
--- python/branches/py3k/Lib/test/test_re.py	(original)
+++ python/branches/py3k/Lib/test/test_re.py	Tue Oct 16 20:12:55 2007
@@ -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]"')

Modified: python/branches/py3k/Lib/test/test_support.py
==============================================================================
--- python/branches/py3k/Lib/test/test_support.py	(original)
+++ python/branches/py3k/Lib/test/test_support.py	Tue Oct 16 20:12:55 2007
@@ -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:

Modified: python/branches/py3k/Lib/test/test_sys.py
==============================================================================
--- python/branches/py3k/Lib/test/test_sys.py	(original)
+++ python/branches/py3k/Lib/test/test_sys.py	Tue Oct 16 20:12:55 2007
@@ -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)

Modified: python/branches/py3k/Lib/test/test_tempfile.py
==============================================================================
--- python/branches/py3k/Lib/test/test_tempfile.py	(original)
+++ python/branches/py3k/Lib/test/test_tempfile.py	Tue Oct 16 20:12:55 2007
@@ -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):

Modified: python/branches/py3k/Lib/test/test_textwrap.py
==============================================================================
--- python/branches/py3k/Lib/test/test_textwrap.py	(original)
+++ python/branches/py3k/Lib/test/test_textwrap.py	Tue Oct 16 20:12:55 2007
@@ -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
 

Modified: python/branches/py3k/Lib/test/test_unittest.py
==============================================================================
--- python/branches/py3k/Lib/test/test_unittest.py	(original)
+++ python/branches/py3k/Lib/test/test_unittest.py	Tue Oct 16 20:12:55 2007
@@ -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

Modified: python/branches/py3k/Lib/timeit.py
==============================================================================
--- python/branches/py3k/Lib/timeit.py	(original)
+++ python/branches/py3k/Lib/timeit.py	Tue Oct 16 20:12:55 2007
@@ -121,9 +121,9 @@
         """Constructor.  See class doc string."""
         self.timer = timer
         ns = {}
-        if isinstance(stmt, basestring):
+        if isinstance(stmt, str):
             stmt = reindent(stmt, 8)
-            if isinstance(setup, basestring):
+            if isinstance(setup, str):
                 setup = reindent(setup, 4)
                 src = template % {'stmt': stmt, 'setup': setup}
             elif hasattr(setup, '__call__'):
@@ -137,7 +137,7 @@
             self.inner = ns["inner"]
         elif hasattr(stmt, '__call__'):
             self.src = None
-            if isinstance(setup, basestring):
+            if isinstance(setup, str):
                 _setup = setup
                 def setup():
                     exec(_setup, globals(), ns)

Modified: python/branches/py3k/Lib/unittest.py
==============================================================================
--- python/branches/py3k/Lib/unittest.py	(original)
+++ python/branches/py3k/Lib/unittest.py	Tue Oct 16 20:12:55 2007
@@ -418,7 +418,7 @@
         self._tests.append(test)
 
     def addTests(self, tests):
-        if isinstance(tests, basestring):
+        if isinstance(tests, str):
             raise TypeError("tests must be an iterable of tests, not a string")
         for test in tests:
             self.addTest(test)

Modified: python/branches/py3k/Lib/urllib2.py
==============================================================================
--- python/branches/py3k/Lib/urllib2.py	(original)
+++ python/branches/py3k/Lib/urllib2.py	Tue Oct 16 20:12:55 2007
@@ -359,7 +359,7 @@
 
     def open(self, fullurl, data=None, timeout=None):
         # accept a URL or a Request object
-        if isinstance(fullurl, basestring):
+        if isinstance(fullurl, str):
             req = Request(fullurl, data)
         else:
             req = fullurl
@@ -702,7 +702,7 @@
 
     def add_password(self, realm, uri, user, passwd):
         # uri could be a single URI or a sequence
-        if isinstance(uri, basestring):
+        if isinstance(uri, str):
             uri = [uri]
         if not realm in self.passwd:
             self.passwd[realm] = {}

Modified: python/branches/py3k/Lib/uu.py
==============================================================================
--- python/branches/py3k/Lib/uu.py	(original)
+++ python/branches/py3k/Lib/uu.py	Tue Oct 16 20:12:55 2007
@@ -46,7 +46,7 @@
     #
     if in_file == '-':
         in_file = sys.stdin.buffer
-    elif isinstance(in_file, basestring):
+    elif isinstance(in_file, str):
         if name is None:
             name = os.path.basename(in_file)
         if mode is None:
@@ -60,7 +60,7 @@
     #
     if out_file == '-':
         out_file = sys.stdout.buffer
-    elif isinstance(out_file, basestring):
+    elif isinstance(out_file, str):
         out_file = open(out_file, 'wb')
     #
     # Set defaults for name and mode
@@ -87,7 +87,7 @@
     #
     if in_file == '-':
         in_file = sys.stdin.buffer
-    elif isinstance(in_file, basestring):
+    elif isinstance(in_file, str):
         in_file = open(in_file, 'rb')
     #
     # Read until a begin is encountered or we've exhausted the file
@@ -118,7 +118,7 @@
     opened = False
     if out_file == '-':
         out_file = sys.stdout.buffer
-    elif isinstance(out_file, basestring):
+    elif isinstance(out_file, str):
         fp = open(out_file, 'wb')
         try:
             os.path.chmod(out_file, mode)
@@ -169,7 +169,7 @@
 
     if options.decode:
         if options.text:
-            if isinstance(output, basestring):
+            if isinstance(output, str):
                 output = open(output, 'wb')
             else:
                 print(sys.argv[0], ': cannot do -t to stdout')
@@ -177,7 +177,7 @@
         decode(input, output)
     else:
         if options.text:
-            if isinstance(input, basestring):
+            if isinstance(input, str):
                 input = open(input, 'rb')
             else:
                 print(sys.argv[0], ': cannot do -t from stdin')

Modified: python/branches/py3k/Lib/warnings.py
==============================================================================
--- python/branches/py3k/Lib/warnings.py	(original)
+++ python/branches/py3k/Lib/warnings.py	Tue Oct 16 20:12:55 2007
@@ -150,10 +150,10 @@
     import re
     assert action in ("error", "ignore", "always", "default", "module",
                       "once"), "invalid action: %r" % (action,)
-    assert isinstance(message, basestring), "message must be a string"
+    assert isinstance(message, str), "message must be a string"
     assert isinstance(category, type), "category must be a class"
     assert issubclass(category, Warning), "category must be a Warning subclass"
-    assert isinstance(module, basestring), "module must be a string"
+    assert isinstance(module, str), "module must be a string"
     assert isinstance(lineno, int) and lineno >= 0, \
            "lineno must be an int >= 0"
     item = (action, re.compile(message, re.I), category,

Modified: python/branches/py3k/Lib/wave.py
==============================================================================
--- python/branches/py3k/Lib/wave.py	(original)
+++ python/branches/py3k/Lib/wave.py	Tue Oct 16 20:12:55 2007
@@ -155,7 +155,7 @@
 
     def __init__(self, f):
         self._i_opened_the_file = None
-        if isinstance(f, basestring):
+        if isinstance(f, str):
             f = __builtin__.open(f, 'rb')
             self._i_opened_the_file = f
         # else, assume it is an open file object already
@@ -299,7 +299,7 @@
 
     def __init__(self, f):
         self._i_opened_the_file = None
-        if isinstance(f, basestring):
+        if isinstance(f, str):
             f = __builtin__.open(f, 'wb')
             self._i_opened_the_file = f
         try:

Modified: python/branches/py3k/Lib/webbrowser.py
==============================================================================
--- python/branches/py3k/Lib/webbrowser.py	(original)
+++ python/branches/py3k/Lib/webbrowser.py	Tue Oct 16 20:12:55 2007
@@ -159,7 +159,7 @@
        and without remote functionality."""
 
     def __init__(self, name):
-        if isinstance(name, basestring):
+        if isinstance(name, str):
             self.name = name
             self.args = ["%s"]
         else:

Modified: python/branches/py3k/Lib/xml/dom/pulldom.py
==============================================================================
--- python/branches/py3k/Lib/xml/dom/pulldom.py	(original)
+++ python/branches/py3k/Lib/xml/dom/pulldom.py	Tue Oct 16 20:12:55 2007
@@ -325,7 +325,7 @@
 def parse(stream_or_string, parser=None, bufsize=None):
     if bufsize is None:
         bufsize = default_bufsize
-    if isinstance(stream_or_string, basestring):
+    if isinstance(stream_or_string, str):
         stream = open(stream_or_string)
     else:
         stream = stream_or_string

Modified: python/branches/py3k/Lib/xml/sax/saxutils.py
==============================================================================
--- python/branches/py3k/Lib/xml/sax/saxutils.py	(original)
+++ python/branches/py3k/Lib/xml/sax/saxutils.py	Tue Oct 16 20:12:55 2007
@@ -272,7 +272,7 @@
     """This function takes an InputSource and an optional base URL and
     returns a fully resolved InputSource object ready for reading."""
 
-    if isinstance(source, basestring):
+    if isinstance(source, str):
         source = xmlreader.InputSource(source)
     elif hasattr(source, "read"):
         f = source

Modified: python/branches/py3k/Lib/xmlrpclib.py
==============================================================================
--- python/branches/py3k/Lib/xmlrpclib.py	(original)
+++ python/branches/py3k/Lib/xmlrpclib.py	Tue Oct 16 20:12:55 2007
@@ -294,7 +294,7 @@
     """
 
     def __init__(self, value=0):
-        if not isinstance(value, basestring):
+        if not isinstance(value, str):
             if datetime and isinstance(value, datetime.datetime):
                 self.value = value.strftime("%Y%m%dT%H:%M:%S")
                 return
@@ -653,7 +653,7 @@
         write("<value><struct>\n")
         for k, v in value.items():
             write("<member>\n")
-            if not isinstance(k, basestring):
+            if not isinstance(k, str):
                 raise TypeError("dictionary key must be string")
             write("<name>%s</name>\n" % escape(k))
             dump(v, write)
@@ -1031,7 +1031,7 @@
     # standard XML-RPC wrappings
     if methodname:
         # a method call
-        if not isinstance(methodname, basestring):
+        if not isinstance(methodname, str):
             methodname = methodname.encode(encoding)
         data = (
             xmlheader,

Modified: python/branches/py3k/Lib/zipfile.py
==============================================================================
--- python/branches/py3k/Lib/zipfile.py	(original)
+++ python/branches/py3k/Lib/zipfile.py	Tue Oct 16 20:12:55 2007
@@ -596,7 +596,7 @@
         self.pwd = None
 
         # Check if we were passed a file-like object
-        if isinstance(file, basestring):
+        if isinstance(file, str):
             # No, it's a filename
             self._filePassed = 0
             self.filename = file

Modified: python/branches/py3k/Modules/_csv.c
==============================================================================
--- python/branches/py3k/Modules/_csv.c	(original)
+++ python/branches/py3k/Modules/_csv.c	Tue Oct 16 20:12:55 2007
@@ -62,7 +62,7 @@
 /* end 2.2 compatibility macros */
 
 #define IS_BASESTRING(o) \
-	PyObject_TypeCheck(o, &PyBaseString_Type)
+	PyUnicode_Check(o)
 
 static PyObject *error_obj;	/* CSV exception */
 static PyObject *dialects;      /* Dialect registry */

Modified: python/branches/py3k/Objects/stringobject.c
==============================================================================
--- python/branches/py3k/Objects/stringobject.c	(original)
+++ python/branches/py3k/Objects/stringobject.c	Tue Oct 16 20:12:55 2007
@@ -3073,14 +3073,6 @@
 }
 
 static PyObject *
-basestring_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
-{
-	PyErr_SetString(PyExc_TypeError,
-			"The basestring type cannot be instantiated");
-	return NULL;
-}
-
-static PyObject *
 string_mod(PyObject *v, PyObject *w)
 {
 	if (!PyString_Check(v)) {
@@ -3090,9 +3082,6 @@
 	return PyString_Format(v, w);
 }
 
-PyDoc_STRVAR(basestring_doc,
-"Type basestring cannot be instantiated; it is the base for str8 and str.");
-
 static PyNumberMethods string_as_number = {
 	0,			/*nb_add*/
 	0,			/*nb_subtract*/
@@ -3100,49 +3089,6 @@
 	string_mod,		/*nb_remainder*/
 };
 
-
-PyTypeObject PyBaseString_Type = {
-	PyVarObject_HEAD_INIT(&PyType_Type, 0)
-	"basestring",
-	0,
-	0,
- 	0,			 		/* tp_dealloc */
-	0,			 		/* tp_print */
-	0,					/* tp_getattr */
-	0,					/* tp_setattr */
-	0,					/* tp_compare */
-	0,		 			/* tp_repr */
-	0,					/* tp_as_number */
-	0,					/* tp_as_sequence */
-	0,					/* tp_as_mapping */
-	0,		 			/* tp_hash */
-	0,					/* tp_call */
-	0,					/* tp_str */
-	0,					/* tp_getattro */
-	0,					/* tp_setattro */
-	0,					/* tp_as_buffer */
-	Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */
-	basestring_doc,				/* tp_doc */
-	0,					/* tp_traverse */
-	0,					/* tp_clear */
-	0,					/* tp_richcompare */
-	0,					/* tp_weaklistoffset */
-	0,					/* tp_iter */
-	0,					/* tp_iternext */
-	0,					/* tp_methods */
-	0,					/* tp_members */
-	0,					/* tp_getset */
-	&PyBaseObject_Type,			/* tp_base */
-	0,					/* tp_dict */
-	0,					/* tp_descr_get */
-	0,					/* tp_descr_set */
-	0,					/* tp_dictoffset */
-	0,					/* tp_init */
-	0,					/* tp_alloc */
-	basestring_new,				/* tp_new */
-	0,		                	/* tp_free */
-};
-
 PyDoc_STRVAR(string_doc,
 "str(object) -> string\n\
 \n\
@@ -3183,7 +3129,7 @@
 	string_methods,				/* tp_methods */
 	0,					/* tp_members */
 	0,					/* tp_getset */
-	&PyBaseString_Type,			/* tp_base */
+	&PyBaseObject_Type,			/* tp_base */
 	0,					/* tp_dict */
 	0,					/* tp_descr_get */
 	0,					/* tp_descr_set */
@@ -3615,7 +3561,7 @@
 		argidx = -2;
 	}
 	if (Py_Type(args)->tp_as_mapping && !PyTuple_Check(args) &&
-	    !PyObject_TypeCheck(args, &PyBaseString_Type))
+	    !PyString_Check(args) && !PyUnicode_Check(args))
 		dict = args;
 	while (--fmtcnt >= 0) {
 		if (*fmt != '%') {

Modified: python/branches/py3k/Objects/unicodeobject.c
==============================================================================
--- python/branches/py3k/Objects/unicodeobject.c	(original)
+++ python/branches/py3k/Objects/unicodeobject.c	Tue Oct 16 20:12:55 2007
@@ -8441,7 +8441,7 @@
 	argidx = -2;
     }
     if (Py_Type(args)->tp_as_mapping && !PyTuple_Check(args) &&
-        !PyObject_TypeCheck(args, &PyBaseString_Type))
+        !PyString_Check(args) && !PyUnicode_Check(args))
 	dict = args;
 
     while (--fmtcnt >= 0) {
@@ -8935,7 +8935,7 @@
     unicode_methods,			/* tp_methods */
     0,					/* tp_members */
     0,					/* tp_getset */
-    &PyBaseString_Type,			/* tp_base */
+    &PyBaseObject_Type,			/* tp_base */
     0,					/* tp_dict */
     0,					/* tp_descr_get */
     0,					/* tp_descr_set */

Modified: python/branches/py3k/Python/bltinmodule.c
==============================================================================
--- python/branches/py3k/Python/bltinmodule.c	(original)
+++ python/branches/py3k/Python/bltinmodule.c	Tue Oct 16 20:12:55 2007
@@ -1595,12 +1595,19 @@
 		}
 	} else {
 		/* reject string values for 'start' parameter */
-		if (PyObject_TypeCheck(result, &PyBaseString_Type)) {
+		if (PyUnicode_Check(result)) {
 			PyErr_SetString(PyExc_TypeError,
 				"sum() can't sum strings [use ''.join(seq) instead]");
 			Py_DECREF(iter);
 			return NULL;
 		}
+		if (PyBytes_Check(result)) {
+			PyErr_SetString(PyExc_TypeError,
+				"sum() can't sum bytes [use b''.join(seq) instead]");
+			Py_DECREF(iter);
+			return NULL;
+		}
+
 		Py_INCREF(result);
 	}
 
@@ -1788,7 +1795,6 @@
 	SETBUILTIN("NotImplemented",	Py_NotImplemented);
 	SETBUILTIN("False",		Py_False);
 	SETBUILTIN("True",		Py_True);
-	SETBUILTIN("basestring",	&PyBaseString_Type);
 	SETBUILTIN("bool",		&PyBool_Type);
 	SETBUILTIN("memoryview",        &PyMemoryView_Type);
 	SETBUILTIN("bytes",		&PyBytes_Type);


More information about the Python-3000-checkins mailing list