import codecs
from encodings import aliases
+import __builtin__
_cache = {}
_unknown = '--unknown--'
"""
# 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)
(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:
Core and builtins
-----------------
+- Bug #1915: Python compiles with --enable-unicode=no again. However
+ several extension methods and modules do not work without unicode
+ support.
+
- Patch #1720595: add T_BOOL to the range of structmember types.
- Issue #1882: when compiling code from a string, encoding cookies in the
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)
{
}
return ret;
}
-
char *
PyTokenizer_RestoreEncoding(struct tok_state* tok, int len, int *offset)
{