summaryrefslogtreecommitdiff
path: root/Lib
diff options
context:
space:
mode:
authorMartin v. Löwis <martin@v.loewis.de>2005-03-08 15:03:08 +0000
committerMartin v. Löwis <martin@v.loewis.de>2005-03-08 15:03:08 +0000
commite2713becd8cb0c3b2db4d33832dd57a1d619f0f3 (patch)
treec46d31f73c95c9a969b6704719dac3e83eb435f1 /Lib
parentConvert file names of posix.access according to the file system encoding. (diff)
downloadcpython-e2713becd8cb0c3b2db4d33832dd57a1d619f0f3.tar.gz
cpython-e2713becd8cb0c3b2db4d33832dd57a1d619f0f3.tar.bz2
cpython-e2713becd8cb0c3b2db4d33832dd57a1d619f0f3.zip
Build with --disable-unicode again. Fixes #1158607.
Will backport to 2.4.
Diffstat (limited to 'Lib')
-rw-r--r--Lib/codecs.py18
-rw-r--r--Lib/copy.py4
-rw-r--r--Lib/test/test_support.py2
3 files changed, 16 insertions, 8 deletions
diff --git a/Lib/codecs.py b/Lib/codecs.py
index b283925e01f..b4103fb6e46 100644
--- a/Lib/codecs.py
+++ b/Lib/codecs.py
@@ -720,11 +720,19 @@ def make_encoding_map(decoding_map):
### error handlers
-strict_errors = lookup_error("strict")
-ignore_errors = lookup_error("ignore")
-replace_errors = lookup_error("replace")
-xmlcharrefreplace_errors = lookup_error("xmlcharrefreplace")
-backslashreplace_errors = lookup_error("backslashreplace")
+try:
+ strict_errors = lookup_error("strict")
+ ignore_errors = lookup_error("ignore")
+ replace_errors = lookup_error("replace")
+ xmlcharrefreplace_errors = lookup_error("xmlcharrefreplace")
+ backslashreplace_errors = lookup_error("backslashreplace")
+except LookupError:
+ # In --disable-unicode builds, these error handler are missing
+ strict_errors = None
+ ignore_errors = None
+ replace_errors = None
+ xmlcharrefreplace_errors = None
+ backslashreplace_errors = None
# Tell modulefinder that using codecs probably needs the encodings
# package
diff --git a/Lib/copy.py b/Lib/copy.py
index b216beb3364..dbfe2f58a3b 100644
--- a/Lib/copy.py
+++ b/Lib/copy.py
@@ -202,12 +202,12 @@ d[float] = _deepcopy_atomic
d[bool] = _deepcopy_atomic
try:
d[complex] = _deepcopy_atomic
-except AttributeError:
+except NameError:
pass
d[str] = _deepcopy_atomic
try:
d[unicode] = _deepcopy_atomic
-except AttributeError:
+except NameError:
pass
try:
d[types.CodeType] = _deepcopy_atomic
diff --git a/Lib/test/test_support.py b/Lib/test/test_support.py
index 485e9e09f6a..a296caf6d05 100644
--- a/Lib/test/test_support.py
+++ b/Lib/test/test_support.py
@@ -144,7 +144,7 @@ else:
TESTFN_UNICODE_UNENCODEABLE = None
else:
# Japanese characters (I think - from bug 846133)
- TESTFN_UNICODE_UNENCODEABLE = u"@test-\u5171\u6709\u3055\u308c\u308b"
+ TESTFN_UNICODE_UNENCODEABLE = eval('u"@test-\u5171\u6709\u3055\u308c\u308b"')
try:
# XXX - Note - should be using TESTFN_ENCODING here - but for
# Windows, "mbcs" currently always operates as if in