Issue #8767: Restore building with --disable-unicode.
Original patch by Stefano Taschini.
diff --git a/Lib/test/script_helper.py b/Lib/test/script_helper.py
index 337854a..7f7c70e 100644
--- a/Lib/test/script_helper.py
+++ b/Lib/test/script_helper.py
@@ -10,7 +10,13 @@
import py_compile
import contextlib
import shutil
-import zipfile
+try:
+ import zipfile
+except ImportError:
+ # If Python is build without Unicode support, importing _io will
+ # fail, which, in turn, means that zipfile cannot be imported
+ # Most of this module can then still be used.
+ pass
from test.test_support import strip_python_stderr
diff --git a/Lib/test/test_support.py b/Lib/test/test_support.py
index b0a2048..ae6b44f 100644
--- a/Lib/test/test_support.py
+++ b/Lib/test/test_support.py
@@ -405,7 +405,7 @@
the CWD, an error is raised. If it's True, only a warning is raised
and the original CWD is used.
"""
- if isinstance(name, unicode):
+ if have_unicode and isinstance(name, unicode):
try:
name = name.encode(sys.getfilesystemencoding() or 'ascii')
except UnicodeEncodeError: