Issue #8767: Restore building with --disable-unicode.
Original patch by Stefano Taschini.
diff --git a/Lib/glob.py b/Lib/glob.py
index 04364be..d6ddaad 100644
--- a/Lib/glob.py
+++ b/Lib/glob.py
@@ -5,6 +5,14 @@
import re
import fnmatch
+try:
+ _unicode = unicode
+except NameError:
+ # If Python is built without Unicode support, the unicode type
+ # will not exist. Fake one.
+ class _unicode(object):
+ pass
+
__all__ = ["glob", "iglob"]
def glob(pathname):
@@ -49,7 +57,7 @@
def glob1(dirname, pattern):
if not dirname:
dirname = os.curdir
- if isinstance(pattern, unicode) and not isinstance(dirname, unicode):
+ if isinstance(pattern, _unicode) and not isinstance(dirname, unicode):
dirname = unicode(dirname, sys.getfilesystemencoding() or
sys.getdefaultencoding())
try: