aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/Lib/test/test_codecs.py
Commit message (Collapse)AuthorAge
* gh-98433: Fix quadratic time idna decoding. (#99092)Gregory P. Smith2022-11-07
| | | | | | | | There was an unnecessary quadratic loop in idna decoding. This restores the behavior to linear. This also adds an early length check in IDNA decoding to outright reject huge inputs early on given the ultimate result is defined to be 63 or fewer characters.
* gh-51511: Note that codecs.open()'s encoding parameter affects automatic ↵Stanley2022-10-21
| | | | conversion to binary mode (#94370)
* gh-84623: Remove unused imports in tests (#93772)Victor Stinner2022-06-13
|
* gh-81548: Deprecate octal escape sequences with value larger than 0o377 ↵Serhiy Storchaka2022-04-30
| | | | (GH-91668)
* bpo-46198: rename duplicate tests and remove unused code (GH-30297)Nikita Sobolev2022-03-10
|
* bpo-46659: Fix the MBCS codec alias on Windows (GH-31218)Victor Stinner2022-02-22
|
* bpo-46659: Update the test on the mbcs codec alias (GH-31168)Victor Stinner2022-02-06
| | | | | | | | | | | encodings registers the _alias_mbcs() codec search function before the search_function() codec search function. Previously, the _alias_mbcs() was never used. Fix the test_codecs.test_mbcs_alias() test: use the current ANSI code page, not a fake ANSI code page number. Remove the test_site.test_aliasing_mbcs() test: the alias is now implemented in the encodings module, no longer in the site module.
* bpo-46303: Move fileutils.h private functions to internal C API (GH-30484)Victor Stinner2022-01-11
| | | | | | | | | | Move almost all private functions of Include/cpython/fileutils.h to the internal C API Include/internal/pycore_fileutils.h. Only keep _Py_fopen_obj() in Include/cpython/fileutils.h, since it's used by _testcapi which must not use the internal C API. Move EncodeLocaleEx() and DecodeLocaleEx() functions from _testcapi to _testinternalcapi, since the C API moved to the internal C API.
* bpo-45668: Fix PGO tests without test extensions (GH-29315)Christian Heimes2021-11-01
|
* bpo-45467: Fix IncrementalDecoder and StreamReader in the ↵Serhiy Storchaka2021-10-14
| | | | | | | | | "raw-unicode-escape" codec (GH-28944) They support now splitting escape sequences between input chunks. Add the third parameter "final" in codecs.raw_unicode_escape_decode(). It is True by default to match the former behavior.
* bpo-45461: Fix IncrementalDecoder and StreamReader in the "unicode-escape" ↵Serhiy Storchaka2021-10-14
| | | | | | | | | codec (GH-28939) They support now splitting escape sequences between input chunks. Add the third parameter "final" in codecs.unicode_escape_decode(). It is True by default to match the former behavior.
* bpo-37330: open() no longer accept 'U' in file mode (GH-28118)Victor Stinner2021-09-02
| | | | | open(), io.open(), codecs.open() and fileinput.FileInput no longer accept "U" ("universal newline") in the file mode. This flag was deprecated since Python 3.3.
* bpo-42065: Fix incorrectly formatted _codecs.charmap_decode error message ↵Max Bernstein2020-10-17
| | | | (GH-19940)
* bpo-41919, test_codecs: Move codecs.register calls to setUp() (GH-22513)Hai Shi2020-10-16
| | | | * Move the codecs' (un)register operation to testcases. * Remove _codecs._forget_codec() and _PyCodec_Forget()
* bpo-39337: encodings.normalize_encoding() now ignores non-ASCII characters ↵Hai Shi2020-10-14
| | | | (GH-22219)
* bpo-39337: Add a test case for normalizing of codec names (GH-19069)Hai Shi2020-10-08
|
* bpo-41842: Add codecs.unregister() function (GH-22360)Hai Shi2020-09-28
| | | | Add codecs.unregister() and PyCodec_Unregister() functions to unregister a codec search function.
* bpo-41521: Replace whitelist/blacklist with allowlist/denylist (GH-21823)Victor Stinner2020-08-11
| | | Rename 5 test method names in test_codecs and test_typing.
* bpo-40275: Use new test.support helper submodules in tests (GH-21448)Hai Shi2020-08-03
|
* bpo-39674: Revert "bpo-37330: open() no longer accept 'U' in file mode ↵Victor Stinner2020-03-04
| | | | | | | (GH-16959)" (GH-18767) This reverts commit e471e72977c83664f13d041c78549140c86c92de. The mode will be removed from Python 3.10.
* bpo-38971: Open file in codecs.open() closes if exception raised. (GH-17666)Chris A2020-03-02
| | | | | | Open issue in the BPO indicated a desire to make the implementation of codecs.open() at parity with io.open(), which implements a try/except to assure file stream gets closed before an exception is raised.
* bpo-30566: Fix IndexError when using punycode codec (GH-18632)Berker Peksag2020-02-25
| | | | Trying to decode an invalid string with the punycode codec shoud raise UnicodeError.
* Remove binding of captured exceptions when not used to reduce the chances of ↵Pablo Galindo2019-11-19
| | | | | | | creating cycles (GH-17246) Capturing exceptions into names can lead to reference cycles though the __traceback__ attribute of the exceptions in some obscure cases that have been reported previously and fixed individually. As these variables are not used anyway, we can remove the binding to reduce the chances of creating reference cycles. See for example GH-13135
* bpo-37330: open() no longer accept 'U' in file mode (GH-16959)Victor Stinner2019-10-28
| | | | | open(), io.open(), codecs.open() and fileinput.FileInput no longer accept "U" ("universal newline") in the file mode. This flag was deprecated since Python 3.3.
* bpo-37876: Tests for ROT-13 codec (GH-15314)Zeth2019-09-09
| | | | The Rot-13 codec is for educational use but does not have unit tests, dragging down test coverage. This adds a few very simple tests.
* bpo-36311: Fixes decoding multibyte characters around chunk boundaries and ↵Steve Dower2019-08-21
| | | | improves decoding performance (GH-15083)
* Remove unused imports in tests (GH-14518)Victor Stinner2019-07-01
|
* bpo-24214: Fixed the UTF-8 and UTF-16 incremental decoders. (GH-14304)Serhiy Storchaka2019-06-25
| | | | | | | * 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.
* bpo-36778: Remove outdated comment from CodePageTest (GH-13807)Victor Stinner2019-06-04
| | | CP65001Test has been removed.
* bpo-33361: Fix bug with seeking in StreamRecoders (GH-8278)Ammar Askar2019-05-31
|
* bpo-33482: fix codecs.StreamRecoder.writelines (GH-6779)Jelle Zijlstra2019-05-22
| | | | | | A very simple fix. I found this while writing typeshed stubs for StreamRecoder. https://bugs.python.org/issue33482
* bpo-36778: cp65001 encoding becomes an alias to utf_8 (GH-13230)Victor Stinner2019-05-10
|
* bpo-35920: Windows 10 ARM32 platform support (GH-11774)Paul Monson2019-04-25
|
* bpo-24214: Fixed the UTF-8 incremental decoder. (GH-12603)Serhiy Storchaka2019-03-30
| | | | The bug occurred when the encoded surrogate character is passed to the incremental decoder in two chunks.
* bpo-36312: Fix decoders for some code pages. (GH-12369)Serhiy Storchaka2019-03-20
|
* bpo-36297: remove "unicode_internal" codec (GH-12342)Inada Naoki2019-03-18
|
* bpo-22831: Use "with" to avoid possible fd leaks in tests (part 2). (GH-10929)Serhiy Storchaka2019-03-05
|
* bpo-35372: Fix the code page decoder for input > 2 GiB. (GH-10848)Serhiy Storchaka2018-12-03
|
* bpo-34523, bpo-35322: Fix unicode_encode_locale() (GH-10759)Victor Stinner2018-11-28
| | | | | | | | | Fix memory leak in PyUnicode_EncodeLocale() and PyUnicode_EncodeFSDefault() on error handling. Changes: * Fix unicode_encode_locale() error handling * Fix test_codecs.LocaleCodecTest
* bpo-34523: Support surrogatepass in locale codecs (GH-8995)Victor Stinner2018-08-29
| | | | | | | | | | | | | | | | | | | | Add support for the "surrogatepass" error handler in PyUnicode_DecodeFSDefault() and PyUnicode_EncodeFSDefault() for the UTF-8 encoding. Changes: * _Py_DecodeUTF8Ex() and _Py_EncodeUTF8Ex() now support the surrogatepass error handler (_Py_ERROR_SURROGATEPASS). * _Py_DecodeLocaleEx() and _Py_EncodeLocaleEx() now use the _Py_error_handler enum instead of "int surrogateescape" to pass the error handler. These functions now return -3 if the error handler is unknown. * Add unit tests on _Py_DecodeLocaleEx() and _Py_EncodeLocaleEx() in test_codecs. * Rename get_error_handler() to _Py_GetErrorHandler() and expose it as a private function. * _freeze_importlib doesn't need config.filesystem_errors="strict" workaround anymore.
* bpo-22602: Raise an exception in the UTF-7 decoder for ill-formed sequences ↵Zackery Spytz2018-08-19
| | | | | | | starting with "+". (GH-8741) The UTF-7 decoder now raises UnicodeDecodeError for ill-formed sequences starting with "+" (as specified in RFC 2152).
* bpo-29240: PEP 540: Add a new UTF-8 Mode (#855)Victor Stinner2017-12-13
| | | | | | | | | | | | | | | | | | | | | | * 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-29
| | | | | 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-20
| | | | and in codecs.escape_decode() when decode an escaped non-ascii byte.
* Issue #25270: Merge from 3.5Berker Peksag2016-09-16
|\
| * Issue #25270: Prevent codecs.escape_encode() from raising SystemError when ↵Berker Peksag2016-09-16
| | | | | | | | an empty bytestring is passed
* | #27364: Deprecate invalid escape strings in str/byutes.R David Murray2016-09-08
| | | | | | | | 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-08
| | | | | | | | | | | | | | 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-06
| | | | | | | | lookup
* | Issue #23277: Remove unused imports in tests.Serhiy Storchaka2016-04-24
| |