diff options
author | Marc-André Lemburg <mal@egenix.com> | 2008-06-06 12:18:17 (GMT) |
---|---|---|
committer | Marc-André Lemburg <mal@egenix.com> | 2008-06-06 12:18:17 (GMT) |
commit | b2750b5d334e9c8d262009069bce41c15803eca0 (patch) | |
tree | 2c501adf96b37d3afbc32e6fdc344fade85cf3d5 /Lib/encodings/punycode.py | |
parent | 4efb518185d32d573ff65f11b94c6031340a018a (diff) | |
download | cpython-b2750b5d334e9c8d262009069bce41c15803eca0.zip cpython-b2750b5d334e9c8d262009069bce41c15803eca0.tar.gz cpython-b2750b5d334e9c8d262009069bce41c15803eca0.tar.bz2 |
Move the codec decode type checks to bytes/bytearray.decode().
Use faster PyUnicode_FromEncodedObject() for bytes/bytearray.decode().
Add new PyCodec_KnownEncoding() API.
Add new PyUnicode_AsDecodedUnicode() and PyUnicode_AsEncodedUnicode() APIs.
Add missing PyUnicode_AsDecodedObject() to unicodeobject.h
Fix punicode codec to also work on memoryviews.
Diffstat (limited to 'Lib/encodings/punycode.py')
-rw-r--r-- | Lib/encodings/punycode.py | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/Lib/encodings/punycode.py b/Lib/encodings/punycode.py index b801a46..8129af2 100644 --- a/Lib/encodings/punycode.py +++ b/Lib/encodings/punycode.py @@ -183,6 +183,8 @@ def insertion_sort(base, extended, errors): def punycode_decode(text, errors): if isinstance(text, str): text = text.encode("ascii") + if isinstance(text, memoryview): + text = bytes(text) pos = text.rfind(b"-") if pos == -1: base = "" |