]> granicus.if.org Git - python/commitdiff
SF patch #806246: use basestring where possible
authorRaymond Hettinger <python@rcn.com>
Wed, 17 Sep 2003 05:50:59 +0000 (05:50 +0000)
committerRaymond Hettinger <python@rcn.com>
Wed, 17 Sep 2003 05:50:59 +0000 (05:50 +0000)
(Contributed by George Yoshida.)

Lib/doctest.py
Lib/pkgutil.py
Lib/test/test_textwrap.py

index cff050167f298d07cfe61019aa29153a87a4caad..caac69135d5ce87eb8d0b8089c17d0b5eae044f9 100644 (file)
@@ -1187,7 +1187,7 @@ def _normalize_module(module):
         module = sys._getframe(2).f_globals['__name__']
         module = sys.modules[module]
 
-    elif isinstance(module, (str, unicode)):
+    elif isinstance(module, basestring):
         # The ["*"] at the end is a mostly meaningless incantation with
         # a crucial property:  if, e.g., module is 'a.b.c', it convinces
         # __import__ to return c instead of a.
index 42373711c06bcc982906175fc5e569b726e8c44e..fbd708acc226008ff8f9a9b5990b63d3b7a9a266 100644 (file)
@@ -50,7 +50,7 @@ def extend_path(path, name):
     path = path[:] # Start with a copy of the existing path
 
     for dir in sys.path:
-        if not isinstance(dir, (str, unicode)) or not os.path.isdir(dir):
+        if not isinstance(dir, basestring) or not os.path.isdir(dir):
             continue
         subdir = os.path.join(dir, pname)
         # XXX This may still add duplicate entries to path on
index a0111680b42923576aa1745554bf36bad5333297..9b8c58f1b730fe431c78fb22f46dc342c26cafd7 100644 (file)
@@ -23,7 +23,7 @@ class BaseTestCase(unittest.TestCase):
             for i in range(len(textin)):
                 result.append("  %d: %r" % (i, textin[i]))
             result = '\n'.join(result)
-        elif isinstance(textin, (str, unicode)):
+        elif isinstance(textin, basestring):
             result = "  %s\n" % repr(textin)
         return result