Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 7a70ea4

Browse files
committed
SF patch #806246: use basestring where possible
(Contributed by George Yoshida.)
1 parent d21fd7b commit 7a70ea4

3 files changed

Lines changed: 3 additions & 3 deletions

File tree

Lib/doctest.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1187,7 +1187,7 @@ def _normalize_module(module):
11871187
module = sys._getframe(2).f_globals['__name__']
11881188
module = sys.modules[module]
11891189

1190-
elif isinstance(module, (str, unicode)):
1190+
elif isinstance(module, basestring):
11911191
# The ["*"] at the end is a mostly meaningless incantation with
11921192
# a crucial property: if, e.g., module is 'a.b.c', it convinces
11931193
# __import__ to return c instead of a.

Lib/pkgutil.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ def extend_path(path, name):
5050
path = path[:] # Start with a copy of the existing path
5151

5252
for dir in sys.path:
53-
if not isinstance(dir, (str, unicode)) or not os.path.isdir(dir):
53+
if not isinstance(dir, basestring) or not os.path.isdir(dir):
5454
continue
5555
subdir = os.path.join(dir, pname)
5656
# XXX This may still add duplicate entries to path on

Lib/test/test_textwrap.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ def show(self, textin):
2323
for i in range(len(textin)):
2424
result.append(" %d: %r" % (i, textin[i]))
2525
result = '\n'.join(result)
26-
elif isinstance(textin, (str, unicode)):
26+
elif isinstance(textin, basestring):
2727
result = " %s\n" % repr(textin)
2828
return result
2929

0 commit comments

Comments
 (0)