summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_codecs.py
Commit message (Collapse)AuthorAgeFilesLines
* [3.7] bpo-24214: Fixed the UTF-8 and UTF-16 incremental decoders. (GH-14304) ↵Miss Islington (bot)2019-07-021-0/+25
| | | | | | | | | | | | | (GH-14369) * bpo-24214: Fixed the UTF-8 and UTF-16 incremental decoders. (GH-14304) * The UTF-8 incremental decoders fails now fast if encounter a sequence that can't be handled by the error handler. * The UTF-16 incremental decoders with the surrogatepass error handler decodes now a lone low surrogate with final=False. (cherry picked from commit 894263ba80af4b7733c2df95b527e96953922656) Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
* bpo-33361: Fix bug with seeking in StreamRecoders (GH-8278)Miss Islington (bot)2019-05-311-0/+25
| | | | | (cherry picked from commit a6ec1ce1ac05b1258931422e96eac215b6a05459) Co-authored-by: Ammar Askar <ammar_askar@hotmail.com>
* [3.7] bpo-33482: fix codecs.StreamRecoder.writelines (GH-6779) (GH-13502)Jelle Zijlstra2019-05-221-0/+21
| | | | | | | | | | | | | | A very simple fix. I found this while writing typeshed stubs for StreamRecoder. https://bugs.python.org/issue33482. (cherry picked from commit b3be4072888a4ce054993c2801802721466ea02d) Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com> https://bugs.python.org/issue33482
* bpo-24214: Fixed the UTF-8 incremental decoder. (GH-12603) (GH-12627)Miss Islington (bot)2019-03-301-0/+9
| | | | | | | The bug occurred when the encoded surrogate character is passed to the incremental decoder in two chunks. (cherry picked from commit 7a465cb5ee7e298cae626ace1fc3e7d97df79f2e) Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
* bpo-36312: Fix decoders for some code pages. (GH-12369)Miss Islington (bot)2019-03-211-0/+9
| | | | | (cherry picked from commit c1e2c288f41cdc1c6e6e09d9a5277a58232ceb03) Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
* bpo-35372: Fix the code page decoder for input > 2 GiB. (GH-10848)Miss Islington (bot)2018-12-031-0/+18
| | | | | (cherry picked from commit 4013c179117754b039957db4730880bf3285919d) Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
* bpo-29240: PEP 540: Add a new UTF-8 Mode (#855)Victor Stinner2017-12-131-8/+2
| | | | | | | | | | | | | | | | | | | | | | * Add -X utf8 command line option, PYTHONUTF8 environment variable and a new sys.flags.utf8_mode flag. * If the LC_CTYPE locale is "C" at startup: enable automatically the UTF-8 mode. * Add _winapi.GetACP(). encodings._alias_mbcs() now calls _winapi.GetACP() to get the ANSI code page * locale.getpreferredencoding() now returns 'UTF-8' in the UTF-8 mode. As a side effect, open() now uses the UTF-8 encoding by default in this mode. * Py_DecodeLocale() and Py_EncodeLocale() now use the UTF-8 encoding in the UTF-8 Mode. * Update subprocess._args_from_interpreter_flags() to handle -X utf8 * Skip some tests relying on the current locale if the UTF-8 mode is enabled. * Add test_utf8mode.py. * _Py_DecodeUTF8_surrogateescape() gets a new optional parameter to return also the length (number of wide characters). * pymain_get_global_config() and pymain_set_global_config() now always copy flag values, rather than only copying if the new value is greater than the old value.
* bpo-32110: codecs.StreamReader.read(n) now returns not more than n (#4499)Serhiy Storchaka2017-11-281-2/+16
| | | | | characters/bytes for non-negative n. This makes it compatible with read() methods of other file-like objects.
* bpo-31825: Fixed OverflowError in the 'unicode-escape' codec (#4058)Serhiy Storchaka2017-10-201-0/+4
| | | | and in codecs.escape_decode() when decode an escaped non-ascii byte.
* Issue #25270: Merge from 3.5Berker Peksag2016-09-161-0/+20
|\
| * Issue #25270: Prevent codecs.escape_encode() from raising SystemError when ↵Berker Peksag2016-09-161-0/+20
| | | | | | | | an empty bytestring is passed
* | #27364: Deprecate invalid escape strings in str/byutes.R David Murray2016-09-081-11/+24
| | | | | | | | Patch by Emanuel Barry, reviewed by Serhiy Storchaka and Martin Panter.
* | #27364: fix "incorrect" uses of escape character in the stdlib.R David Murray2016-09-081-7/+7
| | | | | | | | | | | | | | And most of the tools. Patch by Emanual Barry, reviewed by me, Serhiy Storchaka, and Martin Panter.
* | Issue #27959: Adds oem encoding, alias ansi to mbcs, move aliasmbcs to codec ↵Steve Dower2016-09-071-33/+29
| | | | | | | | lookup
* | Issue #23277: Remove unused imports in tests.Serhiy Storchaka2016-04-241-1/+0
| |
* | Merge typo fixes from 3.5Martin Panter2016-04-161-2/+2
|\ \ | |/
| * Fix typos in code comments and documentationMartin Panter2016-04-161-2/+2
| |
* | Issue #15984: Merge PyUnicode doc from 3.5Martin Panter2016-04-151-1/+1
|\ \ | |/
| * Correct “an” → “a” with “Unicode”, “user”, “UTF”, etcMartin Panter2016-04-151-1/+1
| | | | | | | | This affects documentation, code comments, and a debugging messages.
* | Issue #25523: Merge a-to-an corrections from 3.5Martin Panter2015-11-021-1/+1
|\ \ | |/
| * Issue #25523: Merge "a" to "an" fixes from 3.4 into 3.5Martin Panter2015-11-021-1/+1
| |\
| | * Issue #25523: Correct "a" article to "an" articleMartin Panter2015-11-021-1/+1
| | | | | | | | | | | | | | | | | | This changes the main documentation, doc strings, source code comments, and a couple error messages in the test suite. In some cases the word was removed or edited some other way to fix the grammar.
* | | Issue #25318: Avoid sprintf() in backslashreplace()Victor Stinner2015-10-091-2/+4
| | | | | | | | | | | | | | | | | | Rewrite backslashreplace() to be closer to PyCodec_BackslashReplaceErrors(). Add also unit tests for non-BMP characters.
* | | Issue #25301: The UTF-8 decoder is now up to 15 times as fast for errorVictor Stinner2015-10-051-0/+12
| | | | | | | | | | | | handlers: ``ignore``, ``replace`` and ``surrogateescape``.
* | | Issue #24848: Fixed bugs in UTF-7 decoding of misformed data:Serhiy Storchaka2015-10-021-1/+59
|\ \ \ | |/ / | | | | | | | | | | | | | | | 1. Non-ASCII bytes were accepted after shift sequence. 2. A low surrogate could be emitted in case of error in high surrogate. 3. In some circumstances the '\xfd' character was produced instead of the replacement character '\ufffd' (due to a bug in _PyUnicodeWriter).
| * | Issue #24848: Fixed bugs in UTF-7 decoding of misformed data:Serhiy Storchaka2015-10-021-1/+59
| |\ \ | | |/ | | | | | | | | | | | | | | | 1. Non-ASCII bytes were accepted after shift sequence. 2. A low surrogate could be emitted in case of error in high surrogate. 3. In some circumstances the '\xfd' character was produced instead of the replacement character '\ufffd' (due to a bug in _PyUnicodeWriter).
| | * Issue #24848: Fixed bugs in UTF-7 decoding of misformed data:Serhiy Storchaka2015-10-021-1/+59
| | | | | | | | | | | | | | | 1. Non-ASCII bytes were accepted after shift sequence. 2. A low surrogate could be emitted in case of error in high surrogate.
* | | Issue #25267: The UTF-8 encoder is now up to 75 times as fast for errorVictor Stinner2015-10-011-10/+27
| | | | | | | | | | | | | | | handlers: ``ignore``, ``replace``, ``surrogateescape``, ``surrogatepass``. Patch co-written with Serhiy Storchaka.
* | | Optimize ascii/latin1+surrogateescape encodersVictor Stinner2015-09-291-0/+60
| | | | | | | | | | | | | | | | | | | | | Issue #25227: Optimize ASCII and latin1 encoders with the ``surrogateescape`` error handler: the encoders are now up to 3 times as fast. Initial patch written by Serhiy Storchaka.
* | | Issue #24870: Optimize the ASCII decoder for error handlers: surrogateescape,Victor Stinner2015-09-211-0/+32
|/ / | | | | | | | | | | | | | | ignore and replace. Initial patch written by Naoki Inada. The decoder is now up to 60 times as fast for these error handlers. Add also unit tests for the ASCII decoder.
* | Issue #16473: Merge codecs doc and test from 3.4 into 3.5Martin Panter2015-09-121-0/+8
|\ \ | |/
| * Issue #16473: Fix byte transform codec documentation; test quotetabs=TrueMartin Panter2015-09-121-0/+8
| | | | | | | | | | | | This changes the equivalent functions listed for the Base-64, hex and Quoted- Printable codecs to reflect the functions actually used. Also mention and test the "quotetabs" setting for Quoted-Printable encoding.
* | Issue #22681: Added support for the koi8_t encoding.Serhiy Storchaka2015-05-121-0/+1
| |
* | Issue #22682: Added support for the kz1048 encoding.Serhiy Storchaka2015-05-121-0/+1
| |
* | Issue #23001: Few functions in modules mmap, ossaudiodev, socket, ssl, andSerhiy Storchaka2015-03-201-0/+1
| | | | | | | | | | codecs, that accepted only read-only bytes-like object now accept writable bytes-like object too.
* | Issue #22286, #23321: Fix failing test on Windows code page 932Victor Stinner2015-01-261-1/+1
| | | | | | | | There was a bug which was fixed. The unit test was also wrong.
* | Issue #22286: The "backslashreplace" error handlers now works withSerhiy Storchaka2015-01-251-0/+56
| | | | | | | | decoding and translating.
* | Merge issue 19548 changes from 3.4Nick Coghlan2015-01-061-9/+37
|\ \ | |/
| * Issue 19548: update codecs module documentationNick Coghlan2015-01-061-9/+37
| | | | | | | | | | | | | | | | - clarified the distinction between text encodings and other codecs - clarified relationship with builtin open and the io module - consolidated documentation of error handlers into one section - clarified type constraints of some behaviours - added tests for some of the new statements in the docs
| * Issue #23071: "namereplace_errors" was added only in 3.5.Serhiy Storchaka2014-12-201-1/+0
| |
* | Issue #23071: Added missing names to codecs.__all__. Patch by Martin Panter.Serhiy Storchaka2014-12-201-0/+23
|\ \ | |/
| * Issue #23071: Added missing names to codecs.__all__. Patch by Martin Panter.Serhiy Storchaka2014-12-201-0/+23
| |
* | Issue #19676: Added the "namereplace" error handler.Serhiy Storchaka2014-11-251-0/+7
| |
* | Issue #22406: Fixed the uu_codec codec incorrectly ported to 3.x.Serhiy Storchaka2014-11-071-0/+4
|\ \ | |/ | | | | Based on patch by Martin Panter.
| * Issue #22406: Fixed the uu_codec codec incorrectly ported to 3.x.Serhiy Storchaka2014-11-071-0/+4
| | | | | | | | Based on patch by Martin Panter.
* | Merge fix for issue #22166 from 3.4Nick Coghlan2014-09-151-0/+14
|\ \ | |/
| * Issue #22166: clear codec caches in test_codecsNick Coghlan2014-09-151-0/+14
| |
* | Issue #13916: Fix surrogatepass error handler on WindowsVictor Stinner2014-05-161-6/+0
| |
* | Issue #13916: Disallowed the surrogatepass error handler for non UTF-*Serhiy Storchaka2014-05-151-0/+13
| | | | | | | | encodings.
* | Issue #21488: Add support of keyword arguments for codecs.encode and ↵Victor Stinner2014-05-141-0/+12
| | | | | | | | codecs.decode