]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
gh-62824: Add alias for iso-8859-8-i which is the same as iso-8859-8 (gh-134306)
authorBas Bloemsaat <bas@bloemsaat.com>
Tue, 20 May 2025 13:14:02 +0000 (09:14 -0400)
committerGitHub <noreply@github.com>
Tue, 20 May 2025 13:14:02 +0000 (15:14 +0200)
Co-authored-by: David Goncalves <davegoncalves@gmail.com>
Co-authored-by: Oleg Iarygin <oleg@arhadthedev.net>
Lib/encodings/aliases.py
Lib/test/test_codecs.py
Misc/NEWS.d/next/Library/2023-02-13-21-56-38.gh-issue-62824.CBZzX3.rst [new file with mode: 0644]

index a94bb270671e3777f4c176065c431fcf0ae12a00..4ecb6b6e297a13b31b49394251c7a2a068752c71 100644 (file)
@@ -405,6 +405,8 @@ aliases = {
     'iso_8859_8'         : 'iso8859_8',
     'iso_8859_8_1988'    : 'iso8859_8',
     'iso_ir_138'         : 'iso8859_8',
+    'iso_8859_8_i'       : 'iso8859_8',
+    'iso_8859_8_e'       : 'iso8859_8',
 
     # iso8859_9 codec
     'csisolatin5'        : 'iso8859_9',
index d42270da15ee32d3977778ff21e494e86f10c628..1d6136405f428cdf3c0b43853243b71f8dbf7b19 100644 (file)
@@ -3,6 +3,7 @@ import contextlib
 import copy
 import io
 import pickle
+import os
 import sys
 import unittest
 import encodings
@@ -3107,6 +3108,13 @@ class TransformCodecTest(unittest.TestCase):
                     info = codecs.lookup(alias)
                     self.assertEqual(info.name, expected_name)
 
+    def test_alias_modules_exist(self):
+        encodings_dir = os.path.dirname(encodings.__file__)
+        for value in encodings.aliases.aliases.values():
+            codec_file = os.path.join(encodings_dir, value + ".py")
+            self.assertTrue(os.path.isfile(codec_file),
+                            "Codec file not found: " + codec_file)
+
     def test_quopri_stateless(self):
         # Should encode with quotetabs=True
         encoded = codecs.encode(b"space tab\teol \n", "quopri-codec")
diff --git a/Misc/NEWS.d/next/Library/2023-02-13-21-56-38.gh-issue-62824.CBZzX3.rst b/Misc/NEWS.d/next/Library/2023-02-13-21-56-38.gh-issue-62824.CBZzX3.rst
new file mode 100644 (file)
index 0000000..1fe4e47
--- /dev/null
@@ -0,0 +1 @@
+Fix aliases for ``iso8859_8`` encoding. Patch by Dave Goncalves.