mirror of https://github.com/python/cpython
importing types is not necessary if we use isinstance
This commit is contained in:
parent
38325b730f
commit
391e5f4c9f
|
@ -28,7 +28,7 @@ Written by Marc-Andre Lemburg (mal@lemburg.com).
|
||||||
|
|
||||||
"""#"
|
"""#"
|
||||||
|
|
||||||
import codecs, types
|
import codecs
|
||||||
from encodings import aliases
|
from encodings import aliases
|
||||||
|
|
||||||
_cache = {}
|
_cache = {}
|
||||||
|
@ -60,7 +60,7 @@ def normalize_encoding(encoding):
|
||||||
"""
|
"""
|
||||||
# Make sure we have an 8-bit string, because .translate() works
|
# Make sure we have an 8-bit string, because .translate() works
|
||||||
# differently for Unicode strings.
|
# differently for Unicode strings.
|
||||||
if type(encoding) is types.UnicodeType:
|
if isinstance(encoding, unicode):
|
||||||
# Note that .encode('latin-1') does *not* use the codec
|
# Note that .encode('latin-1') does *not* use the codec
|
||||||
# registry, so this call doesn't recurse. (See unicodeobject.c
|
# registry, so this call doesn't recurse. (See unicodeobject.c
|
||||||
# PyUnicode_AsEncodedString() for details)
|
# PyUnicode_AsEncodedString() for details)
|
||||||
|
|
Loading…
Reference in New Issue