summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2014-12-20 15:46:05 (GMT)
committerSerhiy Storchaka <storchaka@gmail.com>2014-12-20 15:46:05 (GMT)
commit4d33ff6183de7b09a7242e9dd39fd7c8527e0b5b (patch)
tree79e2a6525af2ed097fa99fe1e5f5ad3efa4e5256
parent651647550720556789aaa0dcb5527ff383142eef (diff)
parentde3ee5b94ff9a680d7653ca178b8b66a96a92af8 (diff)
downloadcpython-4d33ff6183de7b09a7242e9dd39fd7c8527e0b5b.zip
cpython-4d33ff6183de7b09a7242e9dd39fd7c8527e0b5b.tar.gz
cpython-4d33ff6183de7b09a7242e9dd39fd7c8527e0b5b.tar.bz2
Issue #23071: Added missing names to codecs.__all__. Patch by Martin Panter.
-rw-r--r--Lib/codecs.py6
-rw-r--r--Lib/test/test_codecs.py23
-rw-r--r--Misc/NEWS2
3 files changed, 31 insertions, 0 deletions
diff --git a/Lib/codecs.py b/Lib/codecs.py
index 85df89a..c20cd6c 100644
--- a/Lib/codecs.py
+++ b/Lib/codecs.py
@@ -20,6 +20,12 @@ __all__ = ["register", "lookup", "open", "EncodedFile", "BOM", "BOM_BE",
"BOM_LE", "BOM32_BE", "BOM32_LE", "BOM64_BE", "BOM64_LE",
"BOM_UTF8", "BOM_UTF16", "BOM_UTF16_LE", "BOM_UTF16_BE",
"BOM_UTF32", "BOM_UTF32_LE", "BOM_UTF32_BE",
+ "CodecInfo", "Codec", "IncrementalEncoder", "IncrementalDecoder",
+ "StreamReader", "StreamWriter",
+ "StreamReaderWriter", "StreamRecoder",
+ "getencoder", "getdecoder", "getincrementalencoder",
+ "getincrementaldecoder", "getreader", "getwriter",
+ "encode", "decode", "iterencode", "iterdecode",
"strict_errors", "ignore_errors", "replace_errors",
"xmlcharrefreplace_errors",
"backslashreplace_errors", "namereplace_errors",
diff --git a/Lib/test/test_codecs.py b/Lib/test/test_codecs.py
index e03a1db..4865ea1 100644
--- a/Lib/test/test_codecs.py
+++ b/Lib/test/test_codecs.py
@@ -1659,6 +1659,29 @@ class CodecsModuleTest(unittest.TestCase):
c = codecs.lookup('ASCII')
self.assertEqual(c.name, 'ascii')
+ def test_all(self):
+ api = (
+ "encode", "decode",
+ "register", "CodecInfo", "Codec", "IncrementalEncoder",
+ "IncrementalDecoder", "StreamReader", "StreamWriter", "lookup",
+ "getencoder", "getdecoder", "getincrementalencoder",
+ "getincrementaldecoder", "getreader", "getwriter",
+ "register_error", "lookup_error",
+ "strict_errors", "replace_errors", "ignore_errors",
+ "xmlcharrefreplace_errors", "backslashreplace_errors",
+ "namereplace_errors",
+ "open", "EncodedFile",
+ "iterencode", "iterdecode",
+ "BOM", "BOM_BE", "BOM_LE",
+ "BOM_UTF8", "BOM_UTF16", "BOM_UTF16_BE", "BOM_UTF16_LE",
+ "BOM_UTF32", "BOM_UTF32_BE", "BOM_UTF32_LE",
+ "BOM32_BE", "BOM32_LE", "BOM64_BE", "BOM64_LE", # Undocumented
+ "StreamReaderWriter", "StreamRecoder",
+ )
+ self.assertCountEqual(api, codecs.__all__)
+ for api in codecs.__all__:
+ getattr(codecs, api)
+
class StreamReaderTest(unittest.TestCase):
def setUp(self):
diff --git a/Misc/NEWS b/Misc/NEWS
index b164b80..fe76f6c 100644
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -196,6 +196,8 @@ Core and Builtins
Library
-------
+- Issue #23071: Added missing names to codecs.__all__. Patch by Martin Panter.
+
- Issue #22783: Pickling now uses the NEWOBJ opcode instead of the NEWOBJ_EX
opcode if possible.