From 4ea52e57304ca20663289fc473522db7fe05cef8 Mon Sep 17 00:00:00 2001 From: Inada Naoki Date: Tue, 27 Apr 2021 10:30:44 +0900 Subject: [PATCH 1/2] bpo-37751: Update `codecs.register()` doc. --- Doc/library/codecs.rst | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/Doc/library/codecs.rst b/Doc/library/codecs.rst index b15d293e38f633b..cf16a9cc3e9715c 100644 --- a/Doc/library/codecs.rst +++ b/Doc/library/codecs.rst @@ -159,9 +159,13 @@ function: .. function:: register(search_function) Register a codec search function. Search functions are expected to take one - argument, being the encoding name in all lower case letters, and return a - :class:`CodecInfo` object. In case a search function cannot find - a given encoding, it should return ``None``. + argument, being the encoding name in all lower case letters and with hyphens + and spaces converted to underscores, and return a :class:`CodecInfo` object. + In case a search function cannot find a given encoding, it should return + ``None``. + + .. versionchanged:: 3.9 + Hyphens and spaces are converted to underscore. .. function:: unregister(search_function) From b2ef59a8a3049ae3be7df6a686f715470ee99f6b Mon Sep 17 00:00:00 2001 From: Inada Naoki Date: Wed, 28 Apr 2021 07:25:35 +0900 Subject: [PATCH 2/2] Update Doc/library/codecs.rst --- Doc/library/codecs.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Doc/library/codecs.rst b/Doc/library/codecs.rst index cf16a9cc3e9715c..0dcd88f9fd5b7fd 100644 --- a/Doc/library/codecs.rst +++ b/Doc/library/codecs.rst @@ -159,7 +159,7 @@ function: .. function:: register(search_function) Register a codec search function. Search functions are expected to take one - argument, being the encoding name in all lower case letters and with hyphens + argument, being the encoding name in all lower case letters with hyphens and spaces converted to underscores, and return a :class:`CodecInfo` object. In case a search function cannot find a given encoding, it should return ``None``.