[Python-checkins] cpython (merge 3.5 -> default): Issue #24824: Signatures of codecs.encode() and codecs.decode() now are

serhiy.storchaka python-checkins at python.org
Sun Aug 9 11:25:55 CEST 2015


https://hg.python.org/cpython/rev/ad65cad76331
changeset:   97339:ad65cad76331
parent:      97337:1d0038dbd8f8
parent:      97338:bdd1df816f84
user:        Serhiy Storchaka <storchaka at gmail.com>
date:        Sun Aug 09 12:25:07 2015 +0300
summary:
  Issue #24824: Signatures of codecs.encode() and codecs.decode() now are
compatible with pydoc.

files:
  Misc/NEWS                        |   3 +++
  Modules/_codecsmodule.c          |  12 ++++++------
  Modules/clinic/_codecsmodule.c.h |  12 +++++-------
  3 files changed, 14 insertions(+), 13 deletions(-)


diff --git a/Misc/NEWS b/Misc/NEWS
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -15,6 +15,9 @@
 Library
 -------
 
+- Issue #24824: Signatures of codecs.encode() and codecs.decode() now are
+  compatible with pydoc.
+
 - Issue #4395: Better testing and documentation of binary operators.
   Patch by Martin Panter.
 
diff --git a/Modules/_codecsmodule.c b/Modules/_codecsmodule.c
--- a/Modules/_codecsmodule.c
+++ b/Modules/_codecsmodule.c
@@ -91,12 +91,12 @@
 /*[clinic input]
 _codecs.encode
     obj: object
-    encoding: str(c_default="NULL") = sys.getdefaultencoding()
+    encoding: str(c_default="NULL") = "utf-8"
     errors: str(c_default="NULL") = "strict"
 
 Encodes obj using the codec registered for encoding.
 
-encoding defaults to the default encoding.  errors may be given to set a
+The default encoding is 'utf-8'.  errors may be given to set a
 different error handling scheme.  Default is 'strict' meaning that encoding
 errors raise a ValueError.  Other possible values are 'ignore', 'replace'
 and 'backslashreplace' as well as any other name registered with
@@ -106,7 +106,7 @@
 static PyObject *
 _codecs_encode_impl(PyModuleDef *module, PyObject *obj, const char *encoding,
                     const char *errors)
-/*[clinic end generated code: output=5c073f62249c8d7c input=2440d769df020a0e]*/
+/*[clinic end generated code: output=5c073f62249c8d7c input=cd5b685040ff61f0]*/
 {
     if (encoding == NULL)
         encoding = PyUnicode_GetDefaultEncoding();
@@ -118,12 +118,12 @@
 /*[clinic input]
 _codecs.decode
     obj: object
-    encoding: str(c_default="NULL") = sys.getdefaultencoding()
+    encoding: str(c_default="NULL") = "utf-8"
     errors: str(c_default="NULL") = "strict"
 
 Decodes obj using the codec registered for encoding.
 
-encoding defaults to the default encoding.  errors may be given to set a
+Default encoding is 'utf-8'.  errors may be given to set a
 different error handling scheme.  Default is 'strict' meaning that encoding
 errors raise a ValueError.  Other possible values are 'ignore', 'replace'
 and 'backslashreplace' as well as any other name registered with
@@ -133,7 +133,7 @@
 static PyObject *
 _codecs_decode_impl(PyModuleDef *module, PyObject *obj, const char *encoding,
                     const char *errors)
-/*[clinic end generated code: output=c81cbf6189a7f878 input=a351e5f5baad1544]*/
+/*[clinic end generated code: output=c81cbf6189a7f878 input=7702c0cc2fa1add6]*/
 {
     if (encoding == NULL)
         encoding = PyUnicode_GetDefaultEncoding();
diff --git a/Modules/clinic/_codecsmodule.c.h b/Modules/clinic/_codecsmodule.c.h
--- a/Modules/clinic/_codecsmodule.c.h
+++ b/Modules/clinic/_codecsmodule.c.h
@@ -42,13 +42,12 @@
 }
 
 PyDoc_STRVAR(_codecs_encode__doc__,
-"encode($module, /, obj, encoding=sys.getdefaultencoding(),\n"
-"       errors=\'strict\')\n"
+"encode($module, /, obj, encoding=\'utf-8\', errors=\'strict\')\n"
 "--\n"
 "\n"
 "Encodes obj using the codec registered for encoding.\n"
 "\n"
-"encoding defaults to the default encoding.  errors may be given to set a\n"
+"The default encoding is \'utf-8\'.  errors may be given to set a\n"
 "different error handling scheme.  Default is \'strict\' meaning that encoding\n"
 "errors raise a ValueError.  Other possible values are \'ignore\', \'replace\'\n"
 "and \'backslashreplace\' as well as any other name registered with\n"
@@ -80,13 +79,12 @@
 }
 
 PyDoc_STRVAR(_codecs_decode__doc__,
-"decode($module, /, obj, encoding=sys.getdefaultencoding(),\n"
-"       errors=\'strict\')\n"
+"decode($module, /, obj, encoding=\'utf-8\', errors=\'strict\')\n"
 "--\n"
 "\n"
 "Decodes obj using the codec registered for encoding.\n"
 "\n"
-"encoding defaults to the default encoding.  errors may be given to set a\n"
+"Default encoding is \'utf-8\'.  errors may be given to set a\n"
 "different error handling scheme.  Default is \'strict\' meaning that encoding\n"
 "errors raise a ValueError.  Other possible values are \'ignore\', \'replace\'\n"
 "and \'backslashreplace\' as well as any other name registered with\n"
@@ -1395,4 +1393,4 @@
 #ifndef _CODECS_CODE_PAGE_ENCODE_METHODDEF
     #define _CODECS_CODE_PAGE_ENCODE_METHODDEF
 #endif /* !defined(_CODECS_CODE_PAGE_ENCODE_METHODDEF) */
-/*[clinic end generated code: output=713a4081788da1bc input=a9049054013a1b77]*/
+/*[clinic end generated code: output=9c9967048027c1c7 input=a9049054013a1b77]*/

-- 
Repository URL: https://hg.python.org/cpython


More information about the Python-checkins mailing list