[Python-checkins] r60215 - in python/branches/release25-maint: Lib/encodings/__init__.py Lib/optparse.py Misc/NEWS Parser/tokenizer.c
christian.heimes
python-checkins at python.org
Wed Jan 23 15:20:41 CET 2008
Author: christian.heimes
Date: Wed Jan 23 15:20:41 2008
New Revision: 60215
Modified:
python/branches/release25-maint/Lib/encodings/__init__.py
python/branches/release25-maint/Lib/optparse.py
python/branches/release25-maint/Misc/NEWS
python/branches/release25-maint/Parser/tokenizer.c
Log:
Fixed bug #1915: Python compiles with --enable-unicode=no again. However several extension methods and modules do not work without unicode support.
Modified: python/branches/release25-maint/Lib/encodings/__init__.py
==============================================================================
--- python/branches/release25-maint/Lib/encodings/__init__.py (original)
+++ python/branches/release25-maint/Lib/encodings/__init__.py Wed Jan 23 15:20:41 2008
@@ -60,7 +60,7 @@
"""
# Make sure we have an 8-bit string, because .translate() works
# differently for Unicode strings.
- if type(encoding) is types.UnicodeType:
+ if hasattr(types, "UnicodeType") and type(encoding) is types.UnicodeType:
# Note that .encode('latin-1') does *not* use the codec
# registry, so this call doesn't recurse. (See unicodeobject.c
# PyUnicode_AsEncodedString() for details)
Modified: python/branches/release25-maint/Lib/optparse.py
==============================================================================
--- python/branches/release25-maint/Lib/optparse.py (original)
+++ python/branches/release25-maint/Lib/optparse.py Wed Jan 23 15:20:41 2008
@@ -824,7 +824,11 @@
(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:
Modified: python/branches/release25-maint/Misc/NEWS
==============================================================================
--- python/branches/release25-maint/Misc/NEWS (original)
+++ python/branches/release25-maint/Misc/NEWS Wed Jan 23 15:20:41 2008
@@ -12,6 +12,10 @@
Core and builtins
-----------------
+- Bug #1915: Python compiles with --enable-unicode=no again. However
+ several extension methods and modules do not work without unicode
+ support.
+
- Issue #1678380: distinction between 0.0 and -0.0 was lost during constant
folding optimization. This was a regression from Python 2.4.
Modified: python/branches/release25-maint/Parser/tokenizer.c
==============================================================================
--- python/branches/release25-maint/Parser/tokenizer.c (original)
+++ python/branches/release25-maint/Parser/tokenizer.c Wed Jan 23 15:20:41 2008
@@ -1537,7 +1537,7 @@
there, as it must be empty for PGEN, and we can check for PGEN only
in this file. */
-#ifdef PGEN
+#if defined(PGEN) || !defined(Py_USING_UNICODE)
char*
PyTokenizer_RestoreEncoding(struct tok_state* tok, int len, int* offset)
{
@@ -1557,7 +1557,6 @@
}
return ret;
}
-
char *
PyTokenizer_RestoreEncoding(struct tok_state* tok, int len, int *offset)
{
More information about the Python-checkins
mailing list