Issue #24824: Signatures of codecs.encode() and codecs.decode() now are · pythoncapi/cpython@c97a962 · GitHub
Skip to content

Commit c97a962

Browse files
Issue python#24824: Signatures of codecs.encode() and codecs.decode() now are
compatible with pydoc.
1 parent 83ee5a3 commit c97a962

3 files changed

Lines changed: 14 additions & 13 deletions

File tree

Misc/NEWS

Lines changed: 3 additions & 0 deletions

Modules/_codecsmodule.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -91,12 +91,12 @@ _codecs_lookup_impl(PyModuleDef *module, const char *encoding)
9191
/*[clinic input]
9292
_codecs.encode
9393
obj: object
94-
encoding: str(c_default="NULL") = sys.getdefaultencoding()
94+
encoding: str(c_default="NULL") = "utf-8"
9595
errors: str(c_default="NULL") = "strict"
9696
9797
Encodes obj using the codec registered for encoding.
9898
99-
encoding defaults to the default encoding. errors may be given to set a
99+
The default encoding is 'utf-8'. errors may be given to set a
100100
different error handling scheme. Default is 'strict' meaning that encoding
101101
errors raise a ValueError. Other possible values are 'ignore', 'replace'
102102
and 'backslashreplace' as well as any other name registered with
@@ -106,7 +106,7 @@ codecs.register_error that can handle ValueErrors.
106106
static PyObject *
107107
_codecs_encode_impl(PyModuleDef *module, PyObject *obj, const char *encoding,
108108
const char *errors)
109-
/*[clinic end generated code: output=5c073f62249c8d7c input=2440d769df020a0e]*/
109+
/*[clinic end generated code: output=5c073f62249c8d7c input=cd5b685040ff61f0]*/
110110
{
111111
if (encoding == NULL)
112112
encoding = PyUnicode_GetDefaultEncoding();
@@ -118,12 +118,12 @@ _codecs_encode_impl(PyModuleDef *module, PyObject *obj, const char *encoding,
118118
/*[clinic input]
119119
_codecs.decode
120120
obj: object
121-
encoding: str(c_default="NULL") = sys.getdefaultencoding()
121+
encoding: str(c_default="NULL") = "utf-8"
122122
errors: str(c_default="NULL") = "strict"
123123
124124
Decodes obj using the codec registered for encoding.
125125
126-
encoding defaults to the default encoding. errors may be given to set a
126+
Default encoding is 'utf-8'. errors may be given to set a
127127
different error handling scheme. Default is 'strict' meaning that encoding
128128
errors raise a ValueError. Other possible values are 'ignore', 'replace'
129129
and 'backslashreplace' as well as any other name registered with
@@ -133,7 +133,7 @@ codecs.register_error that can handle ValueErrors.
133133
static PyObject *
134134
_codecs_decode_impl(PyModuleDef *module, PyObject *obj, const char *encoding,
135135
const char *errors)
136-
/*[clinic end generated code: output=c81cbf6189a7f878 input=a351e5f5baad1544]*/
136+
/*[clinic end generated code: output=c81cbf6189a7f878 input=7702c0cc2fa1add6]*/
137137
{
138138
if (encoding == NULL)
139139
encoding = PyUnicode_GetDefaultEncoding();

Modules/clinic/_codecsmodule.c.h

Lines changed: 5 additions & 7 deletions

0 commit comments

Comments
 (0)