aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/Lib/test/test_codecs.py
Commit message (Collapse)AuthorAge
* gh-71339: Use new assertion methods in tests (GH-129046)Serhiy Storchaka14 hours
|
* gh-62824: Add alias for iso-8859-8-i which is the same as iso-8859-8 ↵Bas Bloemsaat2 days
| | | | | | (gh-134306) Co-authored-by: David Goncalves <davegoncalves@gmail.com> Co-authored-by: Oleg Iarygin <oleg@arhadthedev.net>
* gh-133767: Fix use-after-free in the unicode-escape decoder with an error ↵Serhiy Storchaka10 days
| | | | | | | | | | | | | | handler (GH-129648) If the error handler is used, a new bytes object is created to set as the object attribute of UnicodeDecodeError, and that bytes object then replaces the original data. A pointer to the decoded data will became invalid after destroying that temporary bytes object. So we need other way to return the first invalid escape from _PyUnicode_DecodeUnicodeEscapeInternal(). _PyBytes_DecodeEscape() does not have such issue, because it does not use the error handlers registry, but it should be changed for compatibility with _PyUnicode_DecodeUnicodeEscapeInternal().
* gh-133036: Deprecate codecs.open (#133038)Inada Naoki2025-04-30
| | | | Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com> Co-authored-by: Victor Stinner <vstinner@python.org>
* gh-123803: Support arbitrary code page encodings on Windows (GH-123804)Serhiy Storchaka2024-11-18
| | | | | | If the cpXXX encoding is not directly implemented in Python, fall back to use the Windows-specific API codecs.code_page_encode() and codecs.code_page_decode().
* gh-53203: Improve tests for strptime() (GH-125090)Serhiy Storchaka2024-10-08
| | | | | | | | | | Run them with different locales and different date and time. Add the @run_with_locales() decorator to run the test with multiple locales. Improve the run_with_locale() context manager/decorator -- it now catches only expected exceptions and reports the test as skipped if no appropriate locale is available.
* gh-120417: Add #noqa: F401 to tests (#120627)Victor Stinner2024-06-18
| | | | Ignore linter "imported but unused" warnings in tests when the linter doesn't understand how the import is used.
* gh-116417: Move limited C API unicode.c tests to _testlimitedcapi (#116993)Victor Stinner2024-03-19
| | | | | | Split unicode.c tests of _testcapi into two parts: limited C API tests in _testlimitedcapi and non-limited C API tests in _testcapi. Update test_codecs.
* gh-85287: Change codecs to raise precise UnicodeEncodeError and ↵John Sloboda2024-03-17
| | | | | UnicodeDecodeError (#113674) Co-authored-by: Inada Naoki <songofacandy@gmail.com>
* gh-63283: IDNA prefix should be case insensitive (GH-17726)Zackery Spytz2024-03-15
| | | | | | | | Any capitalization of "xn--" should be acceptable for the ACE prefix (see https://tools.ietf.org/html/rfc3490#section-5). Co-authored-by: Pepijn de Vos <pepijndevos@gmail.com> Co-authored-by: Erlend E. Aasland <erlend@python.org> Co-authored-by: Petr Viktorin <encukou@gmail.com>
* gh-109848: Make test_rot13_func in test_codecs independent (GH-109850)Serhiy Storchaka2023-10-07
|
* gh-66143: Allow copying and pickling of CodecInfo object (GH-109235)Furkan Onder2023-09-29
| | | Co-authored-by: Robert Lehmann <mail@robertlehmann.de>
* gh-50644: Forbid pickling of codecs streams (GH-109180)Serhiy Storchaka2023-09-10
| | | | | | | | | Attempts to pickle or create a shallow or deep copy of codecs streams now raise a TypeError. Previously, copying failed with a RecursionError, while pickling produced wrong results that eventually caused unpickling to fail with a RecursionError.
* gh-106300: Improve `assertRaises(Exception)` usages in tests (GH-106302)Nikita Sobolev2023-07-07
|
* gh-102406: replace exception chaining by PEP-678 notes in codecs (#102407)Irit Katriel2023-03-21
|
* 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
|