diff options
author | Christian Heimes <christian@cheimes.de> | 2008-01-23 14:20:50 (GMT) |
---|---|---|
committer | Christian Heimes <christian@cheimes.de> | 2008-01-23 14:20:50 (GMT) |
commit | 082c9b0267e45cdff9bb8d30a4332f63bd14c58e (patch) | |
tree | 614e442cb1dad3aad11bb9d35031d0dac4c04b07 /Lib | |
parent | 964ca4274f2a1bea783b52e74c71d2dcfdb4fafc (diff) | |
download | cpython-082c9b0267e45cdff9bb8d30a4332f63bd14c58e.zip cpython-082c9b0267e45cdff9bb8d30a4332f63bd14c58e.tar.gz cpython-082c9b0267e45cdff9bb8d30a4332f63bd14c58e.tar.bz2 |
Fixed bug #1915: Python compiles with --enable-unicode=no again. However several extension methods and modules do not work without unicode support.
Diffstat (limited to 'Lib')
-rw-r--r-- | Lib/encodings/__init__.py | 3 | ||||
-rw-r--r-- | Lib/optparse.py | 6 |
2 files changed, 7 insertions, 2 deletions
diff --git a/Lib/encodings/__init__.py b/Lib/encodings/__init__.py index 7db44cb..aea7c5e 100644 --- a/Lib/encodings/__init__.py +++ b/Lib/encodings/__init__.py @@ -30,6 +30,7 @@ Written by Marc-Andre Lemburg (mal@lemburg.com). import codecs from encodings import aliases +import __builtin__ _cache = {} _unknown = '--unknown--' @@ -60,7 +61,7 @@ def normalize_encoding(encoding): """ # Make sure we have an 8-bit string, because .translate() works # differently for Unicode strings. - if isinstance(encoding, unicode): + if hasattr(__builtin__, "unicode") and isinstance(encoding, unicode): # Note that .encode('latin-1') does *not* use the codec # registry, so this call doesn't recurse. (See unicodeobject.c # PyUnicode_AsEncodedString() for details) diff --git a/Lib/optparse.py b/Lib/optparse.py index 62d2f7e..4fbe094 100644 --- a/Lib/optparse.py +++ b/Lib/optparse.py @@ -824,7 +824,11 @@ except NameError: (True, False) = (1, 0) def isbasestring(x): - return isinstance(x, types.StringType) or isinstance(x, types.UnicodeType) + try: + return isinstance(x, basestring) + except: + return isinstance(x, types.StringType) or isinstance(x, types.UnicodeType) + class Values: |