Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
0c59ff64
Commit
0c59ff64
authored
May 12, 2015
by
Serhiy Storchaka
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Issue #20173: Converted the _codecs module to Argument Clinic.
parent
5096088c
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
1998 additions
and
616 deletions
+1998
-616
Modules/_codecsmodule.c
Modules/_codecsmodule.c
+629
-615
Modules/clinic/_codecsmodule.c.h
Modules/clinic/_codecsmodule.c.h
+1369
-1
No files found.
Modules/_codecsmodule.c
View file @
0c59ff64
...
@@ -51,16 +51,21 @@ module _codecs
...
@@ -51,16 +51,21 @@ module _codecs
/* --- Registry ----------------------------------------------------------- */
/* --- Registry ----------------------------------------------------------- */
PyDoc_STRVAR
(
register__doc__
,
/*[clinic input]
"register(search_function)
\n
\
_codecs.register
\n
\
search_function: object
Register a codec search function. Search functions are expected to take
\n
\
/
one argument, the encoding name in all lower case letters, and either
\n
\
return None, or a tuple of functions (encoder, decoder, stream_reader,
\n
\
stream_writer) (or a CodecInfo object)."
);
static
Register a codec search function.
PyObject
*
codec_register
(
PyObject
*
self
,
PyObject
*
search_function
)
Search functions are expected to take one argument, the encoding name in
all lower case letters, and either return None, or a tuple of functions
(encoder, decoder, stream_reader, stream_writer) (or a CodecInfo object).
[clinic start generated code]*/
static
PyObject
*
_codecs_register
(
PyModuleDef
*
module
,
PyObject
*
search_function
)
/*[clinic end generated code: output=d17608b6ad380eb8 input=369578467955cae4]*/
{
{
if
(
PyCodec_Register
(
search_function
))
if
(
PyCodec_Register
(
search_function
))
return
NULL
;
return
NULL
;
...
@@ -68,79 +73,73 @@ PyObject *codec_register(PyObject *self, PyObject *search_function)
...
@@ -68,79 +73,73 @@ PyObject *codec_register(PyObject *self, PyObject *search_function)
Py_RETURN_NONE
;
Py_RETURN_NONE
;
}
}
PyDoc_STRVAR
(
lookup__doc__
,
/*[clinic input]
"lookup(encoding) -> CodecInfo
\n
\
_codecs.lookup
\n
\
encoding: str
Looks up a codec tuple in the Python codec registry and returns
\n
\
/
a CodecInfo object."
);
static
PyObject
*
codec_lookup
(
PyObject
*
self
,
PyObject
*
args
)
{
char
*
encoding
;
if
(
!
PyArg_ParseTuple
(
args
,
"s:lookup"
,
&
encoding
))
Looks up a codec tuple in the Python codec registry and returns a CodecInfo object.
return
NULL
;
[clinic start generated code]*/
static
PyObject
*
_codecs_lookup_impl
(
PyModuleDef
*
module
,
const
char
*
encoding
)
/*[clinic end generated code: output=798e41aff0c04ef6 input=3c572c0db3febe9c]*/
{
return
_PyCodec_Lookup
(
encoding
);
return
_PyCodec_Lookup
(
encoding
);
}
}
PyDoc_STRVAR
(
encode__doc__
,
/*[clinic input]
"encode(obj, [encoding[,errors]]) -> object
\n
\
_codecs.encode
\n
\
obj: object
Encodes obj using the codec registered for encoding. encoding defaults
\n
\
encoding: str(c_default="NULL") = sys.getdefaultencoding()
to the default encoding. errors may be given to set a different error
\n
\
errors: str(c_default="NULL") = "strict"
handling scheme. Default is 'strict' meaning that encoding errors raise
\n
\
a ValueError. Other possible values are 'ignore', 'replace' and
\n
\
Encodes obj using the codec registered for encoding.
'xmlcharrefreplace' as well as any other name registered with
\n
\
codecs.register_error that can handle ValueErrors."
);
encoding defaults to the default encoding. 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
codecs.register_error that can handle ValueErrors.
[clinic start generated code]*/
static
PyObject
*
static
PyObject
*
codec_encode
(
PyObject
*
self
,
PyObject
*
args
,
PyObject
*
kwargs
)
_codecs_encode_impl
(
PyModuleDef
*
module
,
PyObject
*
obj
,
const
char
*
encoding
,
const
char
*
errors
)
/*[clinic end generated code: output=5c073f62249c8d7c input=2440d769df020a0e]*/
{
{
static
char
*
kwlist
[]
=
{
"obj"
,
"encoding"
,
"errors"
,
NULL
};
const
char
*
encoding
=
NULL
;
const
char
*
errors
=
NULL
;
PyObject
*
v
;
if
(
!
PyArg_ParseTupleAndKeywords
(
args
,
kwargs
,
"O|ss:encode"
,
kwlist
,
&
v
,
&
encoding
,
&
errors
))
return
NULL
;
if
(
encoding
==
NULL
)
if
(
encoding
==
NULL
)
encoding
=
PyUnicode_GetDefaultEncoding
();
encoding
=
PyUnicode_GetDefaultEncoding
();
/* Encode via the codec registry */
/* Encode via the codec registry */
return
PyCodec_Encode
(
v
,
encoding
,
errors
);
return
PyCodec_Encode
(
obj
,
encoding
,
errors
);
}
}
PyDoc_STRVAR
(
decode__doc__
,
/*[clinic input]
"decode(obj, [encoding[,errors]]) -> object
\n
\
_codecs.decode
\n
\
obj: object
Decodes obj using the codec registered for encoding. encoding defaults
\n
\
encoding: str(c_default="NULL") = sys.getdefaultencoding()
to the default encoding. errors may be given to set a different error
\n
\
errors: str(c_default="NULL") = "strict"
handling scheme. Default is 'strict' meaning that encoding errors raise
\n
\
a ValueError. Other possible values are 'ignore' and 'replace'
\n
\
Decodes obj using the codec registered for encoding.
as well as any other name registered with codecs.register_error that is
\n
\
able to handle ValueErrors."
);
encoding defaults to the default encoding. 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
codecs.register_error that can handle ValueErrors.
[clinic start generated code]*/
static
PyObject
*
static
PyObject
*
codec_decode
(
PyObject
*
self
,
PyObject
*
args
,
PyObject
*
kwargs
)
_codecs_decode_impl
(
PyModuleDef
*
module
,
PyObject
*
obj
,
const
char
*
encoding
,
const
char
*
errors
)
/*[clinic end generated code: output=c81cbf6189a7f878 input=a351e5f5baad1544]*/
{
{
static
char
*
kwlist
[]
=
{
"obj"
,
"encoding"
,
"errors"
,
NULL
};
const
char
*
encoding
=
NULL
;
const
char
*
errors
=
NULL
;
PyObject
*
v
;
if
(
!
PyArg_ParseTupleAndKeywords
(
args
,
kwargs
,
"O|ss:decode"
,
kwlist
,
&
v
,
&
encoding
,
&
errors
))
return
NULL
;
if
(
encoding
==
NULL
)
if
(
encoding
==
NULL
)
encoding
=
PyUnicode_GetDefaultEncoding
();
encoding
=
PyUnicode_GetDefaultEncoding
();
/* Decode via the codec registry */
/* Decode via the codec registry */
return
PyCodec_Decode
(
v
,
encoding
,
errors
);
return
PyCodec_Decode
(
obj
,
encoding
,
errors
);
}
}
/* --- Helpers ------------------------------------------------------------ */
/* --- Helpers ------------------------------------------------------------ */
...
@@ -165,51 +164,49 @@ _codecs__forget_codec_impl(PyModuleDef *module, const char *encoding)
...
@@ -165,51 +164,49 @@ _codecs__forget_codec_impl(PyModuleDef *module, const char *encoding)
}
}
static
static
PyObject
*
codec_tuple
(
PyObject
*
unicode
,
PyObject
*
codec_tuple
(
PyObject
*
decoded
,
Py_ssize_t
len
)
Py_ssize_t
len
)
{
{
PyObject
*
v
;
if
(
decoded
==
NULL
)
if
(
unicode
==
NULL
)
return
NULL
;
return
NULL
;
v
=
Py_BuildValue
(
"On"
,
unicode
,
len
);
return
Py_BuildValue
(
"Nn"
,
decoded
,
len
);
Py_DECREF
(
unicode
);
return
v
;
}
}
/* --- String codecs ------------------------------------------------------ */
/* --- String codecs ------------------------------------------------------ */
/*[clinic input]
_codecs.escape_decode
data: Py_buffer(accept={str, buffer})
errors: str(accept={str, NoneType}) = NULL
/
[clinic start generated code]*/
static
PyObject
*
static
PyObject
*
escape_decode
(
PyObject
*
self
,
_codecs_escape_decode_impl
(
PyModuleDef
*
module
,
Py_buffer
*
data
,
PyObject
*
args
)
const
char
*
errors
)
/*[clinic end generated code: output=648fa3e78d03e658 input=0018edfd99db714d]*/
{
{
Py_buffer
pbuf
;
PyObject
*
decoded
=
PyBytes_DecodeEscape
(
data
->
buf
,
data
->
len
,
const
char
*
errors
=
NULL
;
errors
,
0
,
NULL
);
PyObject
*
result
;
return
codec_tuple
(
decoded
,
data
->
len
);
if
(
!
PyArg_ParseTuple
(
args
,
"s*|z:escape_decode"
,
&
pbuf
,
&
errors
))
return
NULL
;
result
=
codec_tuple
(
PyBytes_DecodeEscape
(
pbuf
.
buf
,
pbuf
.
len
,
errors
,
0
,
NULL
),
pbuf
.
len
);
PyBuffer_Release
(
&
pbuf
);
return
result
;
}
}
/*[clinic input]
_codecs.escape_encode
data: object(subclass_of='&PyBytes_Type')
errors: str(accept={str, NoneType}) = NULL
/
[clinic start generated code]*/
static
PyObject
*
static
PyObject
*
escape_encode
(
PyObject
*
self
,
_codecs_escape_encode_impl
(
PyModuleDef
*
module
,
PyObject
*
data
,
PyObject
*
args
)
const
char
*
errors
)
/*[clinic end generated code: output=fcd6f34fe4111c50 input=da9ded00992f32f2]*/
{
{
PyObject
*
str
;
Py_ssize_t
size
;
Py_ssize_t
size
;
Py_ssize_t
newsize
;
Py_ssize_t
newsize
;
const
char
*
errors
=
NULL
;
PyObject
*
v
;
PyObject
*
v
;
if
(
!
PyArg_ParseTuple
(
args
,
"O!|z:escape_encode"
,
size
=
PyBytes_GET_SIZE
(
data
);
&
PyBytes_Type
,
&
str
,
&
errors
))
return
NULL
;
size
=
PyBytes_GET_SIZE
(
str
);
if
(
size
>
PY_SSIZE_T_MAX
/
4
)
{
if
(
size
>
PY_SSIZE_T_MAX
/
4
)
{
PyErr_SetString
(
PyExc_OverflowError
,
PyErr_SetString
(
PyExc_OverflowError
,
"string is too large to encode"
);
"string is too large to encode"
);
...
@@ -229,7 +226,7 @@ escape_encode(PyObject *self,
...
@@ -229,7 +226,7 @@ escape_encode(PyObject *self,
for
(
i
=
0
;
i
<
size
;
i
++
)
{
for
(
i
=
0
;
i
<
size
;
i
++
)
{
/* There's at least enough room for a hex escape */
/* There's at least enough room for a hex escape */
assert
(
newsize
-
(
p
-
PyBytes_AS_STRING
(
v
))
>=
4
);
assert
(
newsize
-
(
p
-
PyBytes_AS_STRING
(
v
))
>=
4
);
c
=
PyBytes_AS_STRING
(
str
)[
i
];
c
=
PyBytes_AS_STRING
(
data
)[
i
];
if
(
c
==
'\''
||
c
==
'\\'
)
if
(
c
==
'\''
||
c
==
'\\'
)
*
p
++
=
'\\'
,
*
p
++
=
c
;
*
p
++
=
'\\'
,
*
p
++
=
c
;
else
if
(
c
==
'\t'
)
else
if
(
c
==
'\t'
)
...
@@ -257,18 +254,18 @@ escape_encode(PyObject *self,
...
@@ -257,18 +254,18 @@ escape_encode(PyObject *self,
}
}
/* --- Decoder ------------------------------------------------------------ */
/* --- Decoder ------------------------------------------------------------ */
/*[clinic input]
_codecs.unicode_internal_decode
obj: object
errors: str(accept={str, NoneType}) = NULL
/
[clinic start generated code]*/
static
PyObject
*
static
PyObject
*
unicode_internal_decode
(
PyObject
*
self
,
_codecs_unicode_internal_decode_impl
(
PyModuleDef
*
module
,
PyObject
*
obj
,
PyObject
*
args
)
const
char
*
errors
)
/*[clinic end generated code: output=9fe47c2cd8807d92 input=8d57930aeda170c6]*/
{
{
PyObject
*
obj
;
const
char
*
errors
=
NULL
;
if
(
!
PyArg_ParseTuple
(
args
,
"O|z:unicode_internal_decode"
,
&
obj
,
&
errors
))
return
NULL
;
if
(
PyUnicode_Check
(
obj
))
{
if
(
PyUnicode_Check
(
obj
))
{
if
(
PyUnicode_READY
(
obj
)
<
0
)
if
(
PyUnicode_READY
(
obj
)
<
0
)
return
NULL
;
return
NULL
;
...
@@ -289,120 +286,109 @@ unicode_internal_decode(PyObject *self,
...
@@ -289,120 +286,109 @@ unicode_internal_decode(PyObject *self,
}
}
}
}
/*[clinic input]
_codecs.utf_7_decode
data: Py_buffer
errors: str(accept={str, NoneType}) = NULL
final: int(c_default="0") = False
/
[clinic start generated code]*/
static
PyObject
*
static
PyObject
*
utf_7_decode
(
PyObject
*
self
,
_codecs_utf_7_decode_impl
(
PyModuleDef
*
module
,
Py_buffer
*
data
,
PyObject
*
args
)
const
char
*
errors
,
int
final
)
/*[clinic end generated code: output=ca945e907e72e827 input=bc4d6247ecdb01e6]*/
{
{
Py_buffer
pbuf
;
Py_ssize_t
consumed
=
data
->
len
;
const
char
*
errors
=
NULL
;
PyObject
*
decoded
=
PyUnicode_DecodeUTF7Stateful
(
data
->
buf
,
data
->
len
,
int
final
=
0
;
errors
,
Py_ssize_t
consumed
;
final
?
NULL
:
&
consumed
);
PyObject
*
decoded
=
NULL
;
if
(
!
PyArg_ParseTuple
(
args
,
"y*|zi:utf_7_decode"
,
&
pbuf
,
&
errors
,
&
final
))
return
NULL
;
consumed
=
pbuf
.
len
;
decoded
=
PyUnicode_DecodeUTF7Stateful
(
pbuf
.
buf
,
pbuf
.
len
,
errors
,
final
?
NULL
:
&
consumed
);
PyBuffer_Release
(
&
pbuf
);
if
(
decoded
==
NULL
)
return
NULL
;
return
codec_tuple
(
decoded
,
consumed
);
return
codec_tuple
(
decoded
,
consumed
);
}
}
/*[clinic input]
_codecs.utf_8_decode
data: Py_buffer
errors: str(accept={str, NoneType}) = NULL
final: int(c_default="0") = False
/
[clinic start generated code]*/
static
PyObject
*
static
PyObject
*
utf_8_decode
(
PyObject
*
self
,
_codecs_utf_8_decode_impl
(
PyModuleDef
*
module
,
Py_buffer
*
data
,
PyObject
*
args
)
const
char
*
errors
,
int
final
)
/*[clinic end generated code: output=7309f9ff4ef5c9b6 input=39161d71e7422ee2]*/
{
{
Py_buffer
pbuf
;
Py_ssize_t
consumed
=
data
->
len
;
const
char
*
errors
=
NULL
;
PyObject
*
decoded
=
PyUnicode_DecodeUTF8Stateful
(
data
->
buf
,
data
->
len
,
int
final
=
0
;
errors
,
Py_ssize_t
consumed
;
final
?
NULL
:
&
consumed
);
PyObject
*
decoded
=
NULL
;
if
(
!
PyArg_ParseTuple
(
args
,
"y*|zi:utf_8_decode"
,
&
pbuf
,
&
errors
,
&
final
))
return
NULL
;
consumed
=
pbuf
.
len
;
decoded
=
PyUnicode_DecodeUTF8Stateful
(
pbuf
.
buf
,
pbuf
.
len
,
errors
,
final
?
NULL
:
&
consumed
);
PyBuffer_Release
(
&
pbuf
);
if
(
decoded
==
NULL
)
return
NULL
;
return
codec_tuple
(
decoded
,
consumed
);
return
codec_tuple
(
decoded
,
consumed
);
}
}
/*[clinic input]
_codecs.utf_16_decode
data: Py_buffer
errors: str(accept={str, NoneType}) = NULL
final: int(c_default="0") = False
/
[clinic start generated code]*/
static
PyObject
*
static
PyObject
*
utf_16_decode
(
PyObject
*
self
,
_codecs_utf_16_decode_impl
(
PyModuleDef
*
module
,
Py_buffer
*
data
,
PyObject
*
args
)
const
char
*
errors
,
int
final
)
/*[clinic end generated code: output=8d2fa0507d9bef2c input=f3cf01d1461007ce]*/
{
{
Py_buffer
pbuf
;
const
char
*
errors
=
NULL
;
int
byteorder
=
0
;
int
byteorder
=
0
;
int
final
=
0
;
/* This is overwritten unless final is true. */
Py_ssize_t
consumed
;
Py_ssize_t
consumed
=
data
->
len
;
PyObject
*
decoded
;
PyObject
*
decoded
=
PyUnicode_DecodeUTF16Stateful
(
data
->
buf
,
data
->
len
,
errors
,
&
byteorder
,
if
(
!
PyArg_ParseTuple
(
args
,
"y*|zi:utf_16_decode"
,
final
?
NULL
:
&
consumed
);
&
pbuf
,
&
errors
,
&
final
))
return
NULL
;
consumed
=
pbuf
.
len
;
/* This is overwritten unless final is true. */
decoded
=
PyUnicode_DecodeUTF16Stateful
(
pbuf
.
buf
,
pbuf
.
len
,
errors
,
&
byteorder
,
final
?
NULL
:
&
consumed
);
PyBuffer_Release
(
&
pbuf
);
if
(
decoded
==
NULL
)
return
NULL
;
return
codec_tuple
(
decoded
,
consumed
);
return
codec_tuple
(
decoded
,
consumed
);
}
}
/*[clinic input]
_codecs.utf_16_le_decode
data: Py_buffer
errors: str(accept={str, NoneType}) = NULL
final: int(c_default="0") = False
/
[clinic start generated code]*/
static
PyObject
*
static
PyObject
*
utf_16_le_decode
(
PyObject
*
self
,
_codecs_utf_16_le_decode_impl
(
PyModuleDef
*
module
,
Py_buffer
*
data
,
PyObject
*
args
)
const
char
*
errors
,
int
final
)
/*[clinic end generated code: output=4fd621515ef4ce18 input=a77e3bf97335d94e]*/
{
{
Py_buffer
pbuf
;
const
char
*
errors
=
NULL
;
int
byteorder
=
-
1
;
int
byteorder
=
-
1
;
int
final
=
0
;
/* This is overwritten unless final is true. */
Py_ssize_t
consumed
;
Py_ssize_t
consumed
=
data
->
len
;
PyObject
*
decoded
=
NULL
;
PyObject
*
decoded
=
PyUnicode_DecodeUTF16Stateful
(
data
->
buf
,
data
->
len
,
errors
,
&
byteorder
,
if
(
!
PyArg_ParseTuple
(
args
,
"y*|zi:utf_16_le_decode"
,
final
?
NULL
:
&
consumed
);
&
pbuf
,
&
errors
,
&
final
))
return
NULL
;
consumed
=
pbuf
.
len
;
/* This is overwritten unless final is true. */
decoded
=
PyUnicode_DecodeUTF16Stateful
(
pbuf
.
buf
,
pbuf
.
len
,
errors
,
&
byteorder
,
final
?
NULL
:
&
consumed
);
PyBuffer_Release
(
&
pbuf
);
if
(
decoded
==
NULL
)
return
NULL
;
return
codec_tuple
(
decoded
,
consumed
);
return
codec_tuple
(
decoded
,
consumed
);
}
}
/*[clinic input]
_codecs.utf_16_be_decode
data: Py_buffer
errors: str(accept={str, NoneType}) = NULL
final: int(c_default="0") = False
/
[clinic start generated code]*/
static
PyObject
*
static
PyObject
*
utf_16_be_decode
(
PyObject
*
self
,
_codecs_utf_16_be_decode_impl
(
PyModuleDef
*
module
,
Py_buffer
*
data
,
PyObject
*
args
)
const
char
*
errors
,
int
final
)
/*[clinic end generated code: output=792f4eacb3e1fa05 input=606f69fae91b5563]*/
{
{
Py_buffer
pbuf
;
const
char
*
errors
=
NULL
;
int
byteorder
=
1
;
int
byteorder
=
1
;
int
final
=
0
;
/* This is overwritten unless final is true. */
Py_ssize_t
consumed
;
Py_ssize_t
consumed
=
data
->
len
;
PyObject
*
decoded
=
NULL
;
PyObject
*
decoded
=
PyUnicode_DecodeUTF16Stateful
(
data
->
buf
,
data
->
len
,
errors
,
&
byteorder
,
if
(
!
PyArg_ParseTuple
(
args
,
"y*|zi:utf_16_be_decode"
,
final
?
NULL
:
&
consumed
);
&
pbuf
,
&
errors
,
&
final
))
return
NULL
;
consumed
=
pbuf
.
len
;
/* This is overwritten unless final is true. */
decoded
=
PyUnicode_DecodeUTF16Stateful
(
pbuf
.
buf
,
pbuf
.
len
,
errors
,
&
byteorder
,
final
?
NULL
:
&
consumed
);
PyBuffer_Release
(
&
pbuf
);
if
(
decoded
==
NULL
)
return
NULL
;
return
codec_tuple
(
decoded
,
consumed
);
return
codec_tuple
(
decoded
,
consumed
);
}
}
...
@@ -413,98 +399,94 @@ utf_16_be_decode(PyObject *self,
...
@@ -413,98 +399,94 @@ utf_16_be_decode(PyObject *self,
being the value in effect at the end of data.
being the value in effect at the end of data.
*/
*/
/*[clinic input]
_codecs.utf_16_ex_decode
data: Py_buffer
errors: str(accept={str, NoneType}) = NULL
byteorder: int = 0
final: int(c_default="0") = False
/
[clinic start generated code]*/
static
PyObject
*
static
PyObject
*
utf_16_ex_decode
(
PyObject
*
self
,
_codecs_utf_16_ex_decode_impl
(
PyModuleDef
*
module
,
Py_buffer
*
data
,
PyObject
*
args
)
const
char
*
errors
,
int
byteorder
,
int
final
)
/*[clinic end generated code: output=f136a186dc2defa0 input=f6e7f697658c013e]*/
{
{
Py_buffer
pbuf
;
/* This is overwritten unless final is true. */
const
char
*
errors
=
NULL
;
Py_ssize_t
consumed
=
data
->
len
;
int
byteorder
=
0
;
PyObject
*
unicode
,
*
tuple
;
int
final
=
0
;
Py_ssize_t
consumed
;
if
(
!
PyArg_ParseTuple
(
args
,
"y*|zii:utf_16_ex_decode"
,
PyObject
*
decoded
=
PyUnicode_DecodeUTF16Stateful
(
data
->
buf
,
data
->
len
,
&
pbuf
,
&
errors
,
&
byteorder
,
&
final
))
errors
,
&
byteorder
,
return
NULL
;
final
?
NULL
:
&
consumed
);
consumed
=
pbuf
.
len
;
/* This is overwritten unless final is true. */
if
(
decoded
==
NULL
)
unicode
=
PyUnicode_DecodeUTF16Stateful
(
pbuf
.
buf
,
pbuf
.
len
,
errors
,
&
byteorder
,
final
?
NULL
:
&
consumed
);
PyBuffer_Release
(
&
pbuf
);
if
(
unicode
==
NULL
)
return
NULL
;
return
NULL
;
tuple
=
Py_BuildValue
(
"Oni"
,
unicode
,
consumed
,
byteorder
);
return
Py_BuildValue
(
"Nni"
,
decoded
,
consumed
,
byteorder
);
Py_DECREF
(
unicode
);
return
tuple
;
}
}
/*[clinic input]
_codecs.utf_32_decode
data: Py_buffer
errors: str(accept={str, NoneType}) = NULL
final: int(c_default="0") = False
/
[clinic start generated code]*/
static
PyObject
*
static
PyObject
*
utf_32_decode
(
PyObject
*
self
,
_codecs_utf_32_decode_impl
(
PyModuleDef
*
module
,
Py_buffer
*
data
,
PyObject
*
args
)
const
char
*
errors
,
int
final
)
/*[clinic end generated code: output=b7635e55857e8efb input=86d4f41c6c2e763d]*/
{
{
Py_buffer
pbuf
;
const
char
*
errors
=
NULL
;
int
byteorder
=
0
;
int
byteorder
=
0
;
int
final
=
0
;
/* This is overwritten unless final is true. */
Py_ssize_t
consumed
;
Py_ssize_t
consumed
=
data
->
len
;
PyObject
*
decoded
;
PyObject
*
decoded
=
PyUnicode_DecodeUTF32Stateful
(
data
->
buf
,
data
->
len
,
errors
,
&
byteorder
,
if
(
!
PyArg_ParseTuple
(
args
,
"y*|zi:utf_32_decode"
,
final
?
NULL
:
&
consumed
);
&
pbuf
,
&
errors
,
&
final
))
return
NULL
;
consumed
=
pbuf
.
len
;
/* This is overwritten unless final is true. */
decoded
=
PyUnicode_DecodeUTF32Stateful
(
pbuf
.
buf
,
pbuf
.
len
,
errors
,
&
byteorder
,
final
?
NULL
:
&
consumed
);
PyBuffer_Release
(
&
pbuf
);
if
(
decoded
==
NULL
)
return
NULL
;
return
codec_tuple
(
decoded
,
consumed
);
return
codec_tuple
(
decoded
,
consumed
);
}
}
/*[clinic input]
_codecs.utf_32_le_decode
data: Py_buffer
errors: str(accept={str, NoneType}) = NULL
final: int(c_default="0") = False
/
[clinic start generated code]*/
static
PyObject
*
static
PyObject
*
utf_32_le_decode
(
PyObject
*
self
,
_codecs_utf_32_le_decode_impl
(
PyModuleDef
*
module
,
Py_buffer
*
data
,
PyObject
*
args
)
const
char
*
errors
,
int
final
)
/*[clinic end generated code: output=a79d1787d8ddf988 input=d18b650772d188ba]*/
{
{
Py_buffer
pbuf
;
const
char
*
errors
=
NULL
;
int
byteorder
=
-
1
;
int
byteorder
=
-
1
;
int
final
=
0
;
/* This is overwritten unless final is true. */
Py_ssize_t
consumed
;
Py_ssize_t
consumed
=
data
->
len
;
PyObject
*
decoded
;
PyObject
*
decoded
=
PyUnicode_DecodeUTF32Stateful
(
data
->
buf
,
data
->
len
,
errors
,
&
byteorder
,
if
(
!
PyArg_ParseTuple
(
args
,
"y*|zi:utf_32_le_decode"
,
final
?
NULL
:
&
consumed
);
&
pbuf
,
&
errors
,
&
final
))
return
NULL
;
consumed
=
pbuf
.
len
;
/* This is overwritten unless final is true. */
decoded
=
PyUnicode_DecodeUTF32Stateful
(
pbuf
.
buf
,
pbuf
.
len
,
errors
,
&
byteorder
,
final
?
NULL
:
&
consumed
);
PyBuffer_Release
(
&
pbuf
);
if
(
decoded
==
NULL
)
return
NULL
;
return
codec_tuple
(
decoded
,
consumed
);
return
codec_tuple
(
decoded
,
consumed
);
}
}
/*[clinic input]
_codecs.utf_32_be_decode
data: Py_buffer
errors: str(accept={str, NoneType}) = NULL
final: int(c_default="0") = False
/
[clinic start generated code]*/
static
PyObject
*
static
PyObject
*
utf_32_be_decode
(
PyObject
*
self
,
_codecs_utf_32_be_decode_impl
(
PyModuleDef
*
module
,
Py_buffer
*
data
,
PyObject
*
args
)
const
char
*
errors
,
int
final
)
/*[clinic end generated code: output=a8356b0f36779981 input=19c271b5d34926d8]*/
{
{
Py_buffer
pbuf
;
const
char
*
errors
=
NULL
;
int
byteorder
=
1
;
int
byteorder
=
1
;
int
final
=
0
;
/* This is overwritten unless final is true. */
Py_ssize_t
consumed
;
Py_ssize_t
consumed
=
data
->
len
;
PyObject
*
decoded
;
PyObject
*
decoded
=
PyUnicode_DecodeUTF32Stateful
(
data
->
buf
,
data
->
len
,
errors
,
&
byteorder
,
if
(
!
PyArg_ParseTuple
(
args
,
"y*|zi:utf_32_be_decode"
,
final
?
NULL
:
&
consumed
);
&
pbuf
,
&
errors
,
&
final
))
return
NULL
;
consumed
=
pbuf
.
len
;
/* This is overwritten unless final is true. */
decoded
=
PyUnicode_DecodeUTF32Stateful
(
pbuf
.
buf
,
pbuf
.
len
,
errors
,
&
byteorder
,
final
?
NULL
:
&
consumed
);
PyBuffer_Release
(
&
pbuf
);
if
(
decoded
==
NULL
)
return
NULL
;
return
codec_tuple
(
decoded
,
consumed
);
return
codec_tuple
(
decoded
,
consumed
);
}
}
...
@@ -515,167 +497,157 @@ utf_32_be_decode(PyObject *self,
...
@@ -515,167 +497,157 @@ utf_32_be_decode(PyObject *self,
being the value in effect at the end of data.
being the value in effect at the end of data.
*/
*/
/*[clinic input]
_codecs.utf_32_ex_decode
data: Py_buffer
errors: str(accept={str, NoneType}) = NULL
byteorder: int = 0
final: int(c_default="0") = False
/
[clinic start generated code]*/
static
PyObject
*
static
PyObject
*
utf_32_ex_decode
(
PyObject
*
self
,
_codecs_utf_32_ex_decode_impl
(
PyModuleDef
*
module
,
Py_buffer
*
data
,
PyObject
*
args
)
const
char
*
errors
,
int
byteorder
,
int
final
)
/*[clinic end generated code: output=ab8c70977c1992f5 input=4af3e6ccfe34a076]*/
{
{
Py_buffer
pbuf
;
Py_ssize_t
consumed
=
data
->
len
;
const
char
*
errors
=
NULL
;
PyObject
*
decoded
=
PyUnicode_DecodeUTF32Stateful
(
data
->
buf
,
data
->
len
,
int
byteorder
=
0
;
errors
,
&
byteorder
,
PyObject
*
unicode
,
*
tuple
;
final
?
NULL
:
&
consumed
);
int
final
=
0
;
if
(
decoded
==
NULL
)
Py_ssize_t
consumed
;
if
(
!
PyArg_ParseTuple
(
args
,
"y*|zii:utf_32_ex_decode"
,
&
pbuf
,
&
errors
,
&
byteorder
,
&
final
))
return
NULL
;
consumed
=
pbuf
.
len
;
/* This is overwritten unless final is true. */
unicode
=
PyUnicode_DecodeUTF32Stateful
(
pbuf
.
buf
,
pbuf
.
len
,
errors
,
&
byteorder
,
final
?
NULL
:
&
consumed
);
PyBuffer_Release
(
&
pbuf
);
if
(
unicode
==
NULL
)
return
NULL
;
return
NULL
;
tuple
=
Py_BuildValue
(
"Oni"
,
unicode
,
consumed
,
byteorder
);
return
Py_BuildValue
(
"Nni"
,
decoded
,
consumed
,
byteorder
);
Py_DECREF
(
unicode
);
return
tuple
;
}
}
/*[clinic input]
_codecs.unicode_escape_decode
data: Py_buffer(accept={str, buffer})
errors: str(accept={str, NoneType}) = NULL
/
[clinic start generated code]*/
static
PyObject
*
static
PyObject
*
unicode_escape_decode
(
PyObject
*
self
,
_codecs_unicode_escape_decode_impl
(
PyModuleDef
*
module
,
Py_buffer
*
data
,
PyObject
*
args
)
const
char
*
errors
)
/*[clinic end generated code: output=d1aa63f2620c4999 input=49fd27d06813a7f5]*/
{
{
Py_buffer
pbuf
;
PyObject
*
decoded
=
PyUnicode_DecodeUnicodeEscape
(
data
->
buf
,
data
->
len
,
const
char
*
errors
=
NULL
;
errors
);
PyObject
*
unicode
;
return
codec_tuple
(
decoded
,
data
->
len
);
if
(
!
PyArg_ParseTuple
(
args
,
"s*|z:unicode_escape_decode"
,
&
pbuf
,
&
errors
))
return
NULL
;
unicode
=
PyUnicode_DecodeUnicodeEscape
(
pbuf
.
buf
,
pbuf
.
len
,
errors
);
PyBuffer_Release
(
&
pbuf
);
return
codec_tuple
(
unicode
,
pbuf
.
len
);
}
}
/*[clinic input]
_codecs.raw_unicode_escape_decode
data: Py_buffer(accept={str, buffer})
errors: str(accept={str, NoneType}) = NULL
/
[clinic start generated code]*/
static
PyObject
*
static
PyObject
*
raw_unicode_escape_decode
(
PyObject
*
self
,
_codecs_raw_unicode_escape_decode_impl
(
PyModuleDef
*
module
,
Py_buffer
*
data
,
PyObject
*
args
)
const
char
*
errors
)
/*[clinic end generated code: output=0bf96cc182d81379 input=770903a211434ebc]*/
{
{
Py_buffer
pbuf
;
PyObject
*
decoded
=
PyUnicode_DecodeRawUnicodeEscape
(
data
->
buf
,
data
->
len
,
const
char
*
errors
=
NULL
;
errors
);
PyObject
*
unicode
;
return
codec_tuple
(
decoded
,
data
->
len
);
if
(
!
PyArg_ParseTuple
(
args
,
"s*|z:raw_unicode_escape_decode"
,
&
pbuf
,
&
errors
))
return
NULL
;
unicode
=
PyUnicode_DecodeRawUnicodeEscape
(
pbuf
.
buf
,
pbuf
.
len
,
errors
);
PyBuffer_Release
(
&
pbuf
);
return
codec_tuple
(
unicode
,
pbuf
.
len
);
}
}
/*[clinic input]
_codecs.latin_1_decode
data: Py_buffer
errors: str(accept={str, NoneType}) = NULL
/
[clinic start generated code]*/
static
PyObject
*
static
PyObject
*
latin_1_decode
(
PyObject
*
self
,
_codecs_latin_1_decode_impl
(
PyModuleDef
*
module
,
Py_buffer
*
data
,
PyObject
*
args
)
const
char
*
errors
)
/*[clinic end generated code: output=66b916f5055aaf13 input=5cad0f1759c618ec]*/
{
{
Py_buffer
pbuf
;
PyObject
*
decoded
=
PyUnicode_DecodeLatin1
(
data
->
buf
,
data
->
len
,
errors
);
PyObject
*
unicode
;
return
codec_tuple
(
decoded
,
data
->
len
);
const
char
*
errors
=
NULL
;
if
(
!
PyArg_ParseTuple
(
args
,
"y*|z:latin_1_decode"
,
&
pbuf
,
&
errors
))
return
NULL
;
unicode
=
PyUnicode_DecodeLatin1
(
pbuf
.
buf
,
pbuf
.
len
,
errors
);
PyBuffer_Release
(
&
pbuf
);
return
codec_tuple
(
unicode
,
pbuf
.
len
);
}
}
/*[clinic input]
_codecs.ascii_decode
data: Py_buffer
errors: str(accept={str, NoneType}) = NULL
/
[clinic start generated code]*/
static
PyObject
*
static
PyObject
*
ascii_decode
(
PyObject
*
self
,
_codecs_ascii_decode_impl
(
PyModuleDef
*
module
,
Py_buffer
*
data
,
PyObject
*
args
)
const
char
*
errors
)
/*[clinic end generated code: output=7f213a1b5cdafc65 input=ad1106f64037bd16]*/
{
{
Py_buffer
pbuf
;
PyObject
*
decoded
=
PyUnicode_DecodeASCII
(
data
->
buf
,
data
->
len
,
errors
);
PyObject
*
unicode
;
return
codec_tuple
(
decoded
,
data
->
len
);
const
char
*
errors
=
NULL
;
if
(
!
PyArg_ParseTuple
(
args
,
"y*|z:ascii_decode"
,
&
pbuf
,
&
errors
))
return
NULL
;
unicode
=
PyUnicode_DecodeASCII
(
pbuf
.
buf
,
pbuf
.
len
,
errors
);
PyBuffer_Release
(
&
pbuf
);
return
codec_tuple
(
unicode
,
pbuf
.
len
);
}
}
/*[clinic input]
_codecs.charmap_decode
data: Py_buffer
errors: str(accept={str, NoneType}) = NULL
mapping: object = NULL
/
[clinic start generated code]*/
static
PyObject
*
static
PyObject
*
charmap_decode
(
PyObject
*
self
,
_codecs_charmap_decode_impl
(
PyModuleDef
*
module
,
Py_buffer
*
data
,
PyObject
*
args
)
const
char
*
errors
,
PyObject
*
mapping
)
/*[clinic end generated code: output=87d27f365098bbae input=19712ca35c5a80e2]*/
{
{
Py_buffer
pbuf
;
PyObject
*
decoded
;
PyObject
*
unicode
;
const
char
*
errors
=
NULL
;
PyObject
*
mapping
=
NULL
;
if
(
!
PyArg_ParseTuple
(
args
,
"y*|zO:charmap_decode"
,
&
pbuf
,
&
errors
,
&
mapping
))
return
NULL
;
if
(
mapping
==
Py_None
)
if
(
mapping
==
Py_None
)
mapping
=
NULL
;
mapping
=
NULL
;
unicode
=
PyUnicode_DecodeCharmap
(
pbuf
.
buf
,
pbuf
.
len
,
mapping
,
errors
);
decoded
=
PyUnicode_DecodeCharmap
(
data
->
buf
,
data
->
len
,
mapping
,
errors
);
PyBuffer_Release
(
&
pbuf
);
return
codec_tuple
(
decoded
,
data
->
len
);
return
codec_tuple
(
unicode
,
pbuf
.
len
);
}
}
#ifdef HAVE_MBCS
#ifdef HAVE_MBCS
/*[clinic input]
_codecs.mbcs_decode
data: Py_buffer
errors: str(accept={str, NoneType}) = NULL
final: int(c_default="0") = False
/
[clinic start generated code]*/
static
PyObject
*
static
PyObject
*
mbcs_decode
(
PyObject
*
self
,
_codecs_mbcs_decode_impl
(
PyModuleDef
*
module
,
Py_buffer
*
data
,
PyObject
*
args
)
const
char
*
errors
,
int
final
)
/*[clinic end generated code: output=0ebaf3a5b20e53fa input=d492c1ca64f4fa8a]*/
{
{
Py_buffer
pbuf
;
Py_ssize_t
consumed
=
data
->
len
;
const
char
*
errors
=
NULL
;
PyObject
*
decoded
=
PyUnicode_DecodeMBCSStateful
(
data
->
buf
,
data
->
len
,
int
final
=
0
;
errors
,
final
?
NULL
:
&
consumed
);
Py_ssize_t
consumed
;
PyObject
*
decoded
=
NULL
;
if
(
!
PyArg_ParseTuple
(
args
,
"y*|zi:mbcs_decode"
,
&
pbuf
,
&
errors
,
&
final
))
return
NULL
;
consumed
=
pbuf
.
len
;
decoded
=
PyUnicode_DecodeMBCSStateful
(
pbuf
.
buf
,
pbuf
.
len
,
errors
,
final
?
NULL
:
&
consumed
);
PyBuffer_Release
(
&
pbuf
);
if
(
decoded
==
NULL
)
return
NULL
;
return
codec_tuple
(
decoded
,
consumed
);
return
codec_tuple
(
decoded
,
consumed
);
}
}
/*[clinic input]
_codecs.code_page_decode
codepage: int
data: Py_buffer
errors: str(accept={str, NoneType}) = NULL
final: int(c_default="0") = False
/
[clinic start generated code]*/
static
PyObject
*
static
PyObject
*
code_page_decode
(
PyObject
*
self
,
_codecs_code_page_decode_impl
(
PyModuleDef
*
module
,
int
codepage
,
PyObject
*
args
)
Py_buffer
*
data
,
const
char
*
errors
,
int
final
)
/*[clinic end generated code: output=4318e3d9971e31ba input=4f3152a304e21d51]*/
{
{
Py_buffer
pbuf
;
Py_ssize_t
consumed
=
data
->
len
;
const
char
*
errors
=
NULL
;
PyObject
*
decoded
=
PyUnicode_DecodeCodePageStateful
(
code_page
,
int
final
=
0
;
data
->
buf
,
data
->
len
,
Py_ssize_t
consumed
;
errors
,
PyObject
*
decoded
=
NULL
;
final
?
NULL
:
&
consumed
);
int
code_page
;
if
(
!
PyArg_ParseTuple
(
args
,
"iy*|zi:code_page_decode"
,
&
code_page
,
&
pbuf
,
&
errors
,
&
final
))
return
NULL
;
consumed
=
pbuf
.
len
;
decoded
=
PyUnicode_DecodeCodePageStateful
(
code_page
,
pbuf
.
buf
,
pbuf
.
len
,
errors
,
final
?
NULL
:
&
consumed
);
PyBuffer_Release
(
&
pbuf
);
if
(
decoded
==
NULL
)
return
NULL
;
return
codec_tuple
(
decoded
,
consumed
);
return
codec_tuple
(
decoded
,
consumed
);
}
}
...
@@ -683,43 +655,39 @@ code_page_decode(PyObject *self,
...
@@ -683,43 +655,39 @@ code_page_decode(PyObject *self,
/* --- Encoder ------------------------------------------------------------ */
/* --- Encoder ------------------------------------------------------------ */
/*[clinic input]
_codecs.readbuffer_encode
data: Py_buffer(accept={str, buffer})
errors: str(accept={str, NoneType}) = NULL
/
[clinic start generated code]*/
static
PyObject
*
static
PyObject
*
readbuffer_encode
(
PyObject
*
self
,
_codecs_readbuffer_encode_impl
(
PyModuleDef
*
module
,
Py_buffer
*
data
,
PyObject
*
args
)
const
char
*
errors
)
/*[clinic end generated code: output=319cc24083299859 input=b7c322b89d4ab923]*/
{
{
Py_buffer
pdata
;
PyObject
*
result
=
PyBytes_FromStringAndSize
(
data
->
buf
,
data
->
len
);
const
char
*
data
;
return
codec_tuple
(
result
,
data
->
len
);
Py_ssize_t
size
;
const
char
*
errors
=
NULL
;
PyObject
*
result
;
if
(
!
PyArg_ParseTuple
(
args
,
"s*|z:readbuffer_encode"
,
&
pdata
,
&
errors
))
return
NULL
;
data
=
pdata
.
buf
;
size
=
pdata
.
len
;
result
=
PyBytes_FromStringAndSize
(
data
,
size
);
PyBuffer_Release
(
&
pdata
);
return
codec_tuple
(
result
,
size
);
}
}
/*[clinic input]
_codecs.unicode_internal_encode
obj: object
errors: str(accept={str, NoneType}) = NULL
/
[clinic start generated code]*/
static
PyObject
*
static
PyObject
*
unicode_internal_encode
(
PyObject
*
self
,
_codecs_unicode_internal_encode_impl
(
PyModuleDef
*
module
,
PyObject
*
obj
,
PyObject
*
args
)
const
char
*
errors
)
/*[clinic end generated code: output=be08457068ad503b input=8628f0280cf5ba61]*/
{
{
PyObject
*
obj
;
const
char
*
errors
=
NULL
;
if
(
PyErr_WarnEx
(
PyExc_DeprecationWarning
,
if
(
PyErr_WarnEx
(
PyExc_DeprecationWarning
,
"unicode_internal codec has been deprecated"
,
"unicode_internal codec has been deprecated"
,
1
))
1
))
return
NULL
;
return
NULL
;
if
(
!
PyArg_ParseTuple
(
args
,
"O|z:unicode_internal_encode"
,
&
obj
,
&
errors
))
return
NULL
;
if
(
PyUnicode_Check
(
obj
))
{
if
(
PyUnicode_Check
(
obj
))
{
Py_UNICODE
*
u
;
Py_UNICODE
*
u
;
Py_ssize_t
len
,
size
;
Py_ssize_t
len
,
size
;
...
@@ -741,22 +709,26 @@ unicode_internal_encode(PyObject *self,
...
@@ -741,22 +709,26 @@ unicode_internal_encode(PyObject *self,
PyObject
*
result
;
PyObject
*
result
;
if
(
PyObject_GetBuffer
(
obj
,
&
view
,
PyBUF_SIMPLE
)
!=
0
)
if
(
PyObject_GetBuffer
(
obj
,
&
view
,
PyBUF_SIMPLE
)
!=
0
)
return
NULL
;
return
NULL
;
result
=
codec_tuple
(
PyBytes_FromStringAndSize
(
view
.
buf
,
view
.
len
),
view
.
len
);
result
=
codec_tuple
(
PyBytes_FromStringAndSize
(
view
.
buf
,
view
.
len
),
view
.
len
);
PyBuffer_Release
(
&
view
);
PyBuffer_Release
(
&
view
);
return
result
;
return
result
;
}
}
}
}
/*[clinic input]
_codecs.utf_7_encode
str: object
errors: str(accept={str, NoneType}) = NULL
/
[clinic start generated code]*/
static
PyObject
*
static
PyObject
*
utf_7_encode
(
PyObject
*
self
,
_codecs_utf_7_encode_impl
(
PyModuleDef
*
module
,
PyObject
*
str
,
PyObject
*
args
)
const
char
*
errors
)
/*[clinic end generated code: output=a7accc496a32b759 input=fd91a78f103b0421]*/
{
{
PyObject
*
str
,
*
v
;
PyObject
*
v
;
const
char
*
errors
=
NULL
;
if
(
!
PyArg_ParseTuple
(
args
,
"O|z:utf_7_encode"
,
&
str
,
&
errors
))
return
NULL
;
str
=
PyUnicode_FromObject
(
str
);
str
=
PyUnicode_FromObject
(
str
);
if
(
str
==
NULL
||
PyUnicode_READY
(
str
)
<
0
)
{
if
(
str
==
NULL
||
PyUnicode_READY
(
str
)
<
0
)
{
...
@@ -769,16 +741,19 @@ utf_7_encode(PyObject *self,
...
@@ -769,16 +741,19 @@ utf_7_encode(PyObject *self,
return
v
;
return
v
;
}
}
/*[clinic input]
_codecs.utf_8_encode
str: object
errors: str(accept={str, NoneType}) = NULL
/
[clinic start generated code]*/
static
PyObject
*
static
PyObject
*
utf_8_encode
(
PyObject
*
self
,
_codecs_utf_8_encode_impl
(
PyModuleDef
*
module
,
PyObject
*
str
,
PyObject
*
args
)
const
char
*
errors
)
/*[clinic end generated code: output=ec831d80e7aedede input=2c22d40532f071f3]*/
{
{
PyObject
*
str
,
*
v
;
PyObject
*
v
;
const
char
*
errors
=
NULL
;
if
(
!
PyArg_ParseTuple
(
args
,
"O|z:utf_8_encode"
,
&
str
,
&
errors
))
return
NULL
;
str
=
PyUnicode_FromObject
(
str
);
str
=
PyUnicode_FromObject
(
str
);
if
(
str
==
NULL
||
PyUnicode_READY
(
str
)
<
0
)
{
if
(
str
==
NULL
||
PyUnicode_READY
(
str
)
<
0
)
{
...
@@ -798,17 +773,20 @@ utf_8_encode(PyObject *self,
...
@@ -798,17 +773,20 @@ utf_8_encode(PyObject *self,
*/
*/
/*[clinic input]
_codecs.utf_16_encode
str: object
errors: str(accept={str, NoneType}) = NULL
byteorder: int = 0
/
[clinic start generated code]*/
static
PyObject
*
static
PyObject
*
utf_16_encode
(
PyObject
*
self
,
_codecs_utf_16_encode_impl
(
PyModuleDef
*
module
,
PyObject
*
str
,
PyObject
*
args
)
const
char
*
errors
,
int
byteorder
)
/*[clinic end generated code: output=93ac58e960a9ee4d input=3935a489b2d5385e]*/
{
{
PyObject
*
str
,
*
v
;
PyObject
*
v
;
const
char
*
errors
=
NULL
;
int
byteorder
=
0
;
if
(
!
PyArg_ParseTuple
(
args
,
"O|zi:utf_16_encode"
,
&
str
,
&
errors
,
&
byteorder
))
return
NULL
;
str
=
PyUnicode_FromObject
(
str
);
str
=
PyUnicode_FromObject
(
str
);
if
(
str
==
NULL
||
PyUnicode_READY
(
str
)
<
0
)
{
if
(
str
==
NULL
||
PyUnicode_READY
(
str
)
<
0
)
{
...
@@ -821,16 +799,19 @@ utf_16_encode(PyObject *self,
...
@@ -821,16 +799,19 @@ utf_16_encode(PyObject *self,
return
v
;
return
v
;
}
}
/*[clinic input]
_codecs.utf_16_le_encode
str: object
errors: str(accept={str, NoneType}) = NULL
/
[clinic start generated code]*/
static
PyObject
*
static
PyObject
*
utf_16_le_encode
(
PyObject
*
self
,
_codecs_utf_16_le_encode_impl
(
PyModuleDef
*
module
,
PyObject
*
str
,
PyObject
*
args
)
const
char
*
errors
)
/*[clinic end generated code: output=422bedb8da34fb66 input=bc27df05d1d20dfe]*/
{
{
PyObject
*
str
,
*
v
;
PyObject
*
v
;
const
char
*
errors
=
NULL
;
if
(
!
PyArg_ParseTuple
(
args
,
"O|z:utf_16_le_encode"
,
&
str
,
&
errors
))
return
NULL
;
str
=
PyUnicode_FromObject
(
str
);
str
=
PyUnicode_FromObject
(
str
);
if
(
str
==
NULL
||
PyUnicode_READY
(
str
)
<
0
)
{
if
(
str
==
NULL
||
PyUnicode_READY
(
str
)
<
0
)
{
...
@@ -843,16 +824,19 @@ utf_16_le_encode(PyObject *self,
...
@@ -843,16 +824,19 @@ utf_16_le_encode(PyObject *self,
return
v
;
return
v
;
}
}
/*[clinic input]
_codecs.utf_16_be_encode
str: object
errors: str(accept={str, NoneType}) = NULL
/
[clinic start generated code]*/
static
PyObject
*
static
PyObject
*
utf_16_be_encode
(
PyObject
*
self
,
_codecs_utf_16_be_encode_impl
(
PyModuleDef
*
module
,
PyObject
*
str
,
PyObject
*
args
)
const
char
*
errors
)
/*[clinic end generated code: output=3aa7ee9502acdd77 input=5a69d4112763462b]*/
{
{
PyObject
*
str
,
*
v
;
PyObject
*
v
;
const
char
*
errors
=
NULL
;
if
(
!
PyArg_ParseTuple
(
args
,
"O|z:utf_16_be_encode"
,
&
str
,
&
errors
))
return
NULL
;
str
=
PyUnicode_FromObject
(
str
);
str
=
PyUnicode_FromObject
(
str
);
if
(
str
==
NULL
||
PyUnicode_READY
(
str
)
<
0
)
{
if
(
str
==
NULL
||
PyUnicode_READY
(
str
)
<
0
)
{
...
@@ -872,17 +856,20 @@ utf_16_be_encode(PyObject *self,
...
@@ -872,17 +856,20 @@ utf_16_be_encode(PyObject *self,
*/
*/
/*[clinic input]
_codecs.utf_32_encode
str: object
errors: str(accept={str, NoneType}) = NULL
byteorder: int = 0
/
[clinic start generated code]*/
static
PyObject
*
static
PyObject
*
utf_32_encode
(
PyObject
*
self
,
_codecs_utf_32_encode_impl
(
PyModuleDef
*
module
,
PyObject
*
str
,
PyObject
*
args
)
const
char
*
errors
,
int
byteorder
)
/*[clinic end generated code: output=3e7d5a003b02baed input=434a1efa492b8d58]*/
{
{
PyObject
*
str
,
*
v
;
PyObject
*
v
;
const
char
*
errors
=
NULL
;
int
byteorder
=
0
;
if
(
!
PyArg_ParseTuple
(
args
,
"O|zi:utf_32_encode"
,
&
str
,
&
errors
,
&
byteorder
))
return
NULL
;
str
=
PyUnicode_FromObject
(
str
);
str
=
PyUnicode_FromObject
(
str
);
if
(
str
==
NULL
||
PyUnicode_READY
(
str
)
<
0
)
{
if
(
str
==
NULL
||
PyUnicode_READY
(
str
)
<
0
)
{
...
@@ -895,16 +882,19 @@ utf_32_encode(PyObject *self,
...
@@ -895,16 +882,19 @@ utf_32_encode(PyObject *self,
return
v
;
return
v
;
}
}
/*[clinic input]
_codecs.utf_32_le_encode
str: object
errors: str(accept={str, NoneType}) = NULL
/
[clinic start generated code]*/
static
PyObject
*
static
PyObject
*
utf_32_le_encode
(
PyObject
*
self
,
_codecs_utf_32_le_encode_impl
(
PyModuleDef
*
module
,
PyObject
*
str
,
PyObject
*
args
)
const
char
*
errors
)
/*[clinic end generated code: output=5dda641cd33dbfc2 input=dfa2d7dc78b99422]*/
{
{
PyObject
*
str
,
*
v
;
PyObject
*
v
;
const
char
*
errors
=
NULL
;
if
(
!
PyArg_ParseTuple
(
args
,
"O|z:utf_32_le_encode"
,
&
str
,
&
errors
))
return
NULL
;
str
=
PyUnicode_FromObject
(
str
);
str
=
PyUnicode_FromObject
(
str
);
if
(
str
==
NULL
||
PyUnicode_READY
(
str
)
<
0
)
{
if
(
str
==
NULL
||
PyUnicode_READY
(
str
)
<
0
)
{
...
@@ -917,16 +907,19 @@ utf_32_le_encode(PyObject *self,
...
@@ -917,16 +907,19 @@ utf_32_le_encode(PyObject *self,
return
v
;
return
v
;
}
}
/*[clinic input]
_codecs.utf_32_be_encode
str: object
errors: str(accept={str, NoneType}) = NULL
/
[clinic start generated code]*/
static
PyObject
*
static
PyObject
*
utf_32_be_encode
(
PyObject
*
self
,
_codecs_utf_32_be_encode_impl
(
PyModuleDef
*
module
,
PyObject
*
str
,
PyObject
*
args
)
const
char
*
errors
)
/*[clinic end generated code: output=ccca8b44d91a7c7a input=4595617b18169002]*/
{
{
PyObject
*
str
,
*
v
;
PyObject
*
v
;
const
char
*
errors
=
NULL
;
if
(
!
PyArg_ParseTuple
(
args
,
"O|z:utf_32_be_encode"
,
&
str
,
&
errors
))
return
NULL
;
str
=
PyUnicode_FromObject
(
str
);
str
=
PyUnicode_FromObject
(
str
);
if
(
str
==
NULL
||
PyUnicode_READY
(
str
)
<
0
)
{
if
(
str
==
NULL
||
PyUnicode_READY
(
str
)
<
0
)
{
...
@@ -939,16 +932,19 @@ utf_32_be_encode(PyObject *self,
...
@@ -939,16 +932,19 @@ utf_32_be_encode(PyObject *self,
return
v
;
return
v
;
}
}
/*[clinic input]
_codecs.unicode_escape_encode
str: object
errors: str(accept={str, NoneType}) = NULL
/
[clinic start generated code]*/
static
PyObject
*
static
PyObject
*
unicode_escape_encode
(
PyObject
*
self
,
_codecs_unicode_escape_encode_impl
(
PyModuleDef
*
module
,
PyObject
*
str
,
PyObject
*
args
)
const
char
*
errors
)
/*[clinic end generated code: output=389f23d2b8f8d80b input=8273506f14076912]*/
{
{
PyObject
*
str
,
*
v
;
PyObject
*
v
;
const
char
*
errors
=
NULL
;
if
(
!
PyArg_ParseTuple
(
args
,
"O|z:unicode_escape_encode"
,
&
str
,
&
errors
))
return
NULL
;
str
=
PyUnicode_FromObject
(
str
);
str
=
PyUnicode_FromObject
(
str
);
if
(
str
==
NULL
||
PyUnicode_READY
(
str
)
<
0
)
{
if
(
str
==
NULL
||
PyUnicode_READY
(
str
)
<
0
)
{
...
@@ -961,16 +957,19 @@ unicode_escape_encode(PyObject *self,
...
@@ -961,16 +957,19 @@ unicode_escape_encode(PyObject *self,
return
v
;
return
v
;
}
}
/*[clinic input]
_codecs.raw_unicode_escape_encode
str: object
errors: str(accept={str, NoneType}) = NULL
/
[clinic start generated code]*/
static
PyObject
*
static
PyObject
*
raw_unicode_escape_encode
(
PyObject
*
self
,
_codecs_raw_unicode_escape_encode_impl
(
PyModuleDef
*
module
,
PyObject
*
str
,
PyObject
*
args
)
const
char
*
errors
)
/*[clinic end generated code: output=fec4e39d6ec37a62 input=181755d5dfacef3c]*/
{
{
PyObject
*
str
,
*
v
;
PyObject
*
v
;
const
char
*
errors
=
NULL
;
if
(
!
PyArg_ParseTuple
(
args
,
"O|z:raw_unicode_escape_encode"
,
&
str
,
&
errors
))
return
NULL
;
str
=
PyUnicode_FromObject
(
str
);
str
=
PyUnicode_FromObject
(
str
);
if
(
str
==
NULL
||
PyUnicode_READY
(
str
)
<
0
)
{
if
(
str
==
NULL
||
PyUnicode_READY
(
str
)
<
0
)
{
...
@@ -983,16 +982,19 @@ raw_unicode_escape_encode(PyObject *self,
...
@@ -983,16 +982,19 @@ raw_unicode_escape_encode(PyObject *self,
return
v
;
return
v
;
}
}
/*[clinic input]
_codecs.latin_1_encode
str: object
errors: str(accept={str, NoneType}) = NULL
/
[clinic start generated code]*/
static
PyObject
*
static
PyObject
*
latin_1_encode
(
PyObject
*
self
,
_codecs_latin_1_encode_impl
(
PyModuleDef
*
module
,
PyObject
*
str
,
PyObject
*
args
)
const
char
*
errors
)
/*[clinic end generated code: output=ecf00eb8e48c889c input=f03f6dcf1d84bee4]*/
{
{
PyObject
*
str
,
*
v
;
PyObject
*
v
;
const
char
*
errors
=
NULL
;
if
(
!
PyArg_ParseTuple
(
args
,
"O|z:latin_1_encode"
,
&
str
,
&
errors
))
return
NULL
;
str
=
PyUnicode_FromObject
(
str
);
str
=
PyUnicode_FromObject
(
str
);
if
(
str
==
NULL
||
PyUnicode_READY
(
str
)
<
0
)
{
if
(
str
==
NULL
||
PyUnicode_READY
(
str
)
<
0
)
{
...
@@ -1005,16 +1007,19 @@ latin_1_encode(PyObject *self,
...
@@ -1005,16 +1007,19 @@ latin_1_encode(PyObject *self,
return
v
;
return
v
;
}
}
/*[clinic input]
_codecs.ascii_encode
str: object
errors: str(accept={str, NoneType}) = NULL
/
[clinic start generated code]*/
static
PyObject
*
static
PyObject
*
ascii_encode
(
PyObject
*
self
,
_codecs_ascii_encode_impl
(
PyModuleDef
*
module
,
PyObject
*
str
,
PyObject
*
args
)
const
char
*
errors
)
/*[clinic end generated code: output=a9d18fc6b6b91cfb input=d87e25a10a593fee]*/
{
{
PyObject
*
str
,
*
v
;
PyObject
*
v
;
const
char
*
errors
=
NULL
;
if
(
!
PyArg_ParseTuple
(
args
,
"O|z:ascii_encode"
,
&
str
,
&
errors
))
return
NULL
;
str
=
PyUnicode_FromObject
(
str
);
str
=
PyUnicode_FromObject
(
str
);
if
(
str
==
NULL
||
PyUnicode_READY
(
str
)
<
0
)
{
if
(
str
==
NULL
||
PyUnicode_READY
(
str
)
<
0
)
{
...
@@ -1027,17 +1032,21 @@ ascii_encode(PyObject *self,
...
@@ -1027,17 +1032,21 @@ ascii_encode(PyObject *self,
return
v
;
return
v
;
}
}
/*[clinic input]
_codecs.charmap_encode
str: object
errors: str(accept={str, NoneType}) = NULL
mapping: object = NULL
/
[clinic start generated code]*/
static
PyObject
*
static
PyObject
*
charmap_encode
(
PyObject
*
self
,
_codecs_charmap_encode_impl
(
PyModuleDef
*
module
,
PyObject
*
str
,
PyObject
*
args
)
const
char
*
errors
,
PyObject
*
mapping
)
/*[clinic end generated code: output=14ca42b83853c643 input=85f4172661e8dad9]*/
{
{
PyObject
*
str
,
*
v
;
PyObject
*
v
;
const
char
*
errors
=
NULL
;
PyObject
*
mapping
=
NULL
;
if
(
!
PyArg_ParseTuple
(
args
,
"O|zO:charmap_encode"
,
&
str
,
&
errors
,
&
mapping
))
return
NULL
;
if
(
mapping
==
Py_None
)
if
(
mapping
==
Py_None
)
mapping
=
NULL
;
mapping
=
NULL
;
...
@@ -1052,27 +1061,34 @@ charmap_encode(PyObject *self,
...
@@ -1052,27 +1061,34 @@ charmap_encode(PyObject *self,
return
v
;
return
v
;
}
}
static
PyObject
*
/*[clinic input]
charmap_build
(
PyObject
*
self
,
PyObject
*
args
)
_codecs.charmap_build
map: unicode
/
[clinic start generated code]*/
static
PyObject
*
_codecs_charmap_build_impl
(
PyModuleDef
*
module
,
PyObject
*
map
)
/*[clinic end generated code: output=9485b58fa44afa6a input=d91a91d1717dbc6d]*/
{
{
PyObject
*
map
;
if
(
!
PyArg_ParseTuple
(
args
,
"U:charmap_build"
,
&
map
))
return
NULL
;
return
PyUnicode_BuildEncodingMap
(
map
);
return
PyUnicode_BuildEncodingMap
(
map
);
}
}
#ifdef HAVE_MBCS
#ifdef HAVE_MBCS
/*[clinic input]
_codecs.mbcs_encode
str: object
errors: str(accept={str, NoneType}) = NULL
/
[clinic start generated code]*/
static
PyObject
*
static
PyObject
*
mbcs_encode
(
PyObject
*
self
,
_codecs_mbcs_encode_impl
(
PyModuleDef
*
module
,
PyObject
*
str
,
PyObject
*
args
)
const
char
*
errors
)
/*[clinic end generated code: output=d1a013bc68798bd7 input=65c09ee1e4203263]*/
{
{
PyObject
*
str
,
*
v
;
PyObject
*
v
;
const
char
*
errors
=
NULL
;
if
(
!
PyArg_ParseTuple
(
args
,
"O|z:mbcs_encode"
,
&
str
,
&
errors
))
return
NULL
;
str
=
PyUnicode_FromObject
(
str
);
str
=
PyUnicode_FromObject
(
str
);
if
(
str
==
NULL
||
PyUnicode_READY
(
str
)
<
0
)
{
if
(
str
==
NULL
||
PyUnicode_READY
(
str
)
<
0
)
{
...
@@ -1085,17 +1101,20 @@ mbcs_encode(PyObject *self,
...
@@ -1085,17 +1101,20 @@ mbcs_encode(PyObject *self,
return
v
;
return
v
;
}
}
/*[clinic input]
_codecs.code_page_encode
code_page: int
str: object
errors: str(accept={str, NoneType}) = NULL
/
[clinic start generated code]*/
static
PyObject
*
static
PyObject
*
code_page_encode
(
PyObject
*
self
,
_codecs_code_page_encode_impl
(
PyModuleDef
*
module
,
int
code_page
,
PyObject
*
args
)
PyObject
*
str
,
const
char
*
errors
)
/*[clinic end generated code: output=3b406618dbfbce25 input=c8562ec460c2e309]*/
{
{
PyObject
*
str
,
*
v
;
PyObject
*
v
;
const
char
*
errors
=
NULL
;
int
code_page
;
if
(
!
PyArg_ParseTuple
(
args
,
"iO|z:code_page_encode"
,
&
code_page
,
&
str
,
&
errors
))
return
NULL
;
str
=
PyUnicode_FromObject
(
str
);
str
=
PyUnicode_FromObject
(
str
);
if
(
str
==
NULL
||
PyUnicode_READY
(
str
)
<
0
)
{
if
(
str
==
NULL
||
PyUnicode_READY
(
str
)
<
0
)
{
...
@@ -1114,99 +1133,94 @@ code_page_encode(PyObject *self,
...
@@ -1114,99 +1133,94 @@ code_page_encode(PyObject *self,
/* --- Error handler registry --------------------------------------------- */
/* --- Error handler registry --------------------------------------------- */
PyDoc_STRVAR
(
register_error__doc__
,
/*[clinic input]
"register_error(errors, handler)
\n
\
_codecs.register_error
\n
\
errors: str
Register the specified error handler under the name
\n
\
handler: object
errors. handler must be a callable object, that
\n
\
/
will be called with an exception instance containing
\n
\
information about the location of the encoding/decoding
\n
\
error and must return a (replacement, new position) tuple."
);
static
PyObject
*
register_error
(
PyObject
*
self
,
PyObject
*
args
)
Register the specified error handler under the name errors.
{
const
char
*
name
;
PyObject
*
handler
;
if
(
!
PyArg_ParseTuple
(
args
,
"sO:register_error"
,
handler must be a callable object, that will be called with an exception
&
name
,
&
handler
))
instance containing information about the location of the encoding/decoding
return
NULL
;
error and must return a (replacement, new position) tuple.
if
(
PyCodec_RegisterError
(
name
,
handler
))
[clinic start generated code]*/
static
PyObject
*
_codecs_register_error_impl
(
PyModuleDef
*
module
,
const
char
*
errors
,
PyObject
*
handler
)
/*[clinic end generated code: output=be00d3b1849ce68a input=5e6709203c2e33fe]*/
{
if
(
PyCodec_RegisterError
(
errors
,
handler
))
return
NULL
;
return
NULL
;
Py_RETURN_NONE
;
Py_RETURN_NONE
;
}
}
PyDoc_STRVAR
(
lookup_error__doc__
,
/*[clinic input]
"lookup_error(errors) -> handler
\n
\
_codecs.lookup_error
\n
\
name: str
Return the error handler for the specified error handling name
\n
\
/
or raise a LookupError, if no handler exists under this name."
);
static
PyObject
*
lookup_error
(
PyObject
*
self
,
PyObject
*
args
)
lookup_error(errors) -> handler
{
const
char
*
name
;
if
(
!
PyArg_ParseTuple
(
args
,
"s:lookup_error"
,
Return the error handler for the specified error handling name or raise a
&
name
))
LookupError, if no handler exists under this name.
return
NULL
;
[clinic start generated code]*/
static
PyObject
*
_codecs_lookup_error_impl
(
PyModuleDef
*
module
,
const
char
*
name
)
/*[clinic end generated code: output=731e6df8c83c6158 input=4775dd65e6235aba]*/
{
return
PyCodec_LookupError
(
name
);
return
PyCodec_LookupError
(
name
);
}
}
/* --- Module API --------------------------------------------------------- */
/* --- Module API --------------------------------------------------------- */
static
PyMethodDef
_codecs_functions
[]
=
{
static
PyMethodDef
_codecs_functions
[]
=
{
{
"register"
,
codec_register
,
METH_O
,
_CODECS_REGISTER_METHODDEF
register__doc__
},
_CODECS_LOOKUP_METHODDEF
{
"lookup"
,
codec_lookup
,
METH_VARARGS
,
_CODECS_ENCODE_METHODDEF
lookup__doc__
},
_CODECS_DECODE_METHODDEF
{
"encode"
,
(
PyCFunction
)
codec_encode
,
METH_VARARGS
|
METH_KEYWORDS
,
_CODECS_ESCAPE_ENCODE_METHODDEF
encode__doc__
},
_CODECS_ESCAPE_DECODE_METHODDEF
{
"decode"
,
(
PyCFunction
)
codec_decode
,
METH_VARARGS
|
METH_KEYWORDS
,
_CODECS_UTF_8_ENCODE_METHODDEF
decode__doc__
},
_CODECS_UTF_8_DECODE_METHODDEF
{
"escape_encode"
,
escape_encode
,
METH_VARARGS
},
_CODECS_UTF_7_ENCODE_METHODDEF
{
"escape_decode"
,
escape_decode
,
METH_VARARGS
},
_CODECS_UTF_7_DECODE_METHODDEF
{
"utf_8_encode"
,
utf_8_encode
,
METH_VARARGS
},
_CODECS_UTF_16_ENCODE_METHODDEF
{
"utf_8_decode"
,
utf_8_decode
,
METH_VARARGS
},
_CODECS_UTF_16_LE_ENCODE_METHODDEF
{
"utf_7_encode"
,
utf_7_encode
,
METH_VARARGS
},
_CODECS_UTF_16_BE_ENCODE_METHODDEF
{
"utf_7_decode"
,
utf_7_decode
,
METH_VARARGS
},
_CODECS_UTF_16_DECODE_METHODDEF
{
"utf_16_encode"
,
utf_16_encode
,
METH_VARARGS
},
_CODECS_UTF_16_LE_DECODE_METHODDEF
{
"utf_16_le_encode"
,
utf_16_le_encode
,
METH_VARARGS
},
_CODECS_UTF_16_BE_DECODE_METHODDEF
{
"utf_16_be_encode"
,
utf_16_be_encode
,
METH_VARARGS
},
_CODECS_UTF_16_EX_DECODE_METHODDEF
{
"utf_16_decode"
,
utf_16_decode
,
METH_VARARGS
},
_CODECS_UTF_32_ENCODE_METHODDEF
{
"utf_16_le_decode"
,
utf_16_le_decode
,
METH_VARARGS
},
_CODECS_UTF_32_LE_ENCODE_METHODDEF
{
"utf_16_be_decode"
,
utf_16_be_decode
,
METH_VARARGS
},
_CODECS_UTF_32_BE_ENCODE_METHODDEF
{
"utf_16_ex_decode"
,
utf_16_ex_decode
,
METH_VARARGS
},
_CODECS_UTF_32_DECODE_METHODDEF
{
"utf_32_encode"
,
utf_32_encode
,
METH_VARARGS
},
_CODECS_UTF_32_LE_DECODE_METHODDEF
{
"utf_32_le_encode"
,
utf_32_le_encode
,
METH_VARARGS
},
_CODECS_UTF_32_BE_DECODE_METHODDEF
{
"utf_32_be_encode"
,
utf_32_be_encode
,
METH_VARARGS
},
_CODECS_UTF_32_EX_DECODE_METHODDEF
{
"utf_32_decode"
,
utf_32_decode
,
METH_VARARGS
},
_CODECS_UNICODE_ESCAPE_ENCODE_METHODDEF
{
"utf_32_le_decode"
,
utf_32_le_decode
,
METH_VARARGS
},
_CODECS_UNICODE_ESCAPE_DECODE_METHODDEF
{
"utf_32_be_decode"
,
utf_32_be_decode
,
METH_VARARGS
},
_CODECS_UNICODE_INTERNAL_ENCODE_METHODDEF
{
"utf_32_ex_decode"
,
utf_32_ex_decode
,
METH_VARARGS
},
_CODECS_UNICODE_INTERNAL_DECODE_METHODDEF
{
"unicode_escape_encode"
,
unicode_escape_encode
,
METH_VARARGS
},
_CODECS_RAW_UNICODE_ESCAPE_ENCODE_METHODDEF
{
"unicode_escape_decode"
,
unicode_escape_decode
,
METH_VARARGS
},
_CODECS_RAW_UNICODE_ESCAPE_DECODE_METHODDEF
{
"unicode_internal_encode"
,
unicode_internal_encode
,
METH_VARARGS
},
_CODECS_LATIN_1_ENCODE_METHODDEF
{
"unicode_internal_decode"
,
unicode_internal_decode
,
METH_VARARGS
},
_CODECS_LATIN_1_DECODE_METHODDEF
{
"raw_unicode_escape_encode"
,
raw_unicode_escape_encode
,
METH_VARARGS
},
_CODECS_ASCII_ENCODE_METHODDEF
{
"raw_unicode_escape_decode"
,
raw_unicode_escape_decode
,
METH_VARARGS
},
_CODECS_ASCII_DECODE_METHODDEF
{
"latin_1_encode"
,
latin_1_encode
,
METH_VARARGS
},
_CODECS_CHARMAP_ENCODE_METHODDEF
{
"latin_1_decode"
,
latin_1_decode
,
METH_VARARGS
},
_CODECS_CHARMAP_DECODE_METHODDEF
{
"ascii_encode"
,
ascii_encode
,
METH_VARARGS
},
_CODECS_CHARMAP_BUILD_METHODDEF
{
"ascii_decode"
,
ascii_decode
,
METH_VARARGS
},
_CODECS_READBUFFER_ENCODE_METHODDEF
{
"charmap_encode"
,
charmap_encode
,
METH_VARARGS
},
_CODECS_MBCS_ENCODE_METHODDEF
{
"charmap_decode"
,
charmap_decode
,
METH_VARARGS
},
_CODECS_MBCS_DECODE_METHODDEF
{
"charmap_build"
,
charmap_build
,
METH_VARARGS
},
_CODECS_CODE_PAGE_ENCODE_METHODDEF
{
"readbuffer_encode"
,
readbuffer_encode
,
METH_VARARGS
},
_CODECS_CODE_PAGE_DECODE_METHODDEF
#ifdef HAVE_MBCS
_CODECS_REGISTER_ERROR_METHODDEF
{
"mbcs_encode"
,
mbcs_encode
,
METH_VARARGS
},
_CODECS_LOOKUP_ERROR_METHODDEF
{
"mbcs_decode"
,
mbcs_decode
,
METH_VARARGS
},
{
"code_page_encode"
,
code_page_encode
,
METH_VARARGS
},
{
"code_page_decode"
,
code_page_decode
,
METH_VARARGS
},
#endif
{
"register_error"
,
register_error
,
METH_VARARGS
,
register_error__doc__
},
{
"lookup_error"
,
lookup_error
,
METH_VARARGS
,
lookup_error__doc__
},
_CODECS__FORGET_CODEC_METHODDEF
_CODECS__FORGET_CODEC_METHODDEF
{
NULL
,
NULL
}
/* sentinel */
{
NULL
,
NULL
}
/* sentinel */
};
};
...
...
Modules/clinic/_codecsmodule.c.h
View file @
0c59ff64
...
@@ -2,6 +2,121 @@
...
@@ -2,6 +2,121 @@
preserve
preserve
[clinic start generated code]*/
[clinic start generated code]*/
PyDoc_STRVAR
(
_codecs_register__doc__
,
"register($module, search_function, /)
\n
"
"--
\n
"
"
\n
"
"Register a codec search function.
\n
"
"
\n
"
"Search functions are expected to take one argument, the encoding name in
\n
"
"all lower case letters, and either return None, or a tuple of functions
\n
"
"(encoder, decoder, stream_reader, stream_writer) (or a CodecInfo object)."
);
#define _CODECS_REGISTER_METHODDEF \
{"register", (PyCFunction)_codecs_register, METH_O, _codecs_register__doc__},
PyDoc_STRVAR
(
_codecs_lookup__doc__
,
"lookup($module, encoding, /)
\n
"
"--
\n
"
"
\n
"
"Looks up a codec tuple in the Python codec registry and returns a CodecInfo object."
);
#define _CODECS_LOOKUP_METHODDEF \
{"lookup", (PyCFunction)_codecs_lookup, METH_O, _codecs_lookup__doc__},
static
PyObject
*
_codecs_lookup_impl
(
PyModuleDef
*
module
,
const
char
*
encoding
);
static
PyObject
*
_codecs_lookup
(
PyModuleDef
*
module
,
PyObject
*
arg
)
{
PyObject
*
return_value
=
NULL
;
const
char
*
encoding
;
if
(
!
PyArg_Parse
(
arg
,
"s:lookup"
,
&
encoding
))
goto
exit
;
return_value
=
_codecs_lookup_impl
(
module
,
encoding
);
exit:
return
return_value
;
}
PyDoc_STRVAR
(
_codecs_encode__doc__
,
"encode($module, /, obj, encoding=sys.getdefaultencoding(),
\n
"
" 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
"
"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
"
"codecs.register_error that can handle ValueErrors."
);
#define _CODECS_ENCODE_METHODDEF \
{"encode", (PyCFunction)_codecs_encode, METH_VARARGS|METH_KEYWORDS, _codecs_encode__doc__},
static
PyObject
*
_codecs_encode_impl
(
PyModuleDef
*
module
,
PyObject
*
obj
,
const
char
*
encoding
,
const
char
*
errors
);
static
PyObject
*
_codecs_encode
(
PyModuleDef
*
module
,
PyObject
*
args
,
PyObject
*
kwargs
)
{
PyObject
*
return_value
=
NULL
;
static
char
*
_keywords
[]
=
{
"obj"
,
"encoding"
,
"errors"
,
NULL
};
PyObject
*
obj
;
const
char
*
encoding
=
NULL
;
const
char
*
errors
=
NULL
;
if
(
!
PyArg_ParseTupleAndKeywords
(
args
,
kwargs
,
"O|ss:encode"
,
_keywords
,
&
obj
,
&
encoding
,
&
errors
))
goto
exit
;
return_value
=
_codecs_encode_impl
(
module
,
obj
,
encoding
,
errors
);
exit:
return
return_value
;
}
PyDoc_STRVAR
(
_codecs_decode__doc__
,
"decode($module, /, obj, encoding=sys.getdefaultencoding(),
\n
"
" 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
"
"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
"
"codecs.register_error that can handle ValueErrors."
);
#define _CODECS_DECODE_METHODDEF \
{"decode", (PyCFunction)_codecs_decode, METH_VARARGS|METH_KEYWORDS, _codecs_decode__doc__},
static
PyObject
*
_codecs_decode_impl
(
PyModuleDef
*
module
,
PyObject
*
obj
,
const
char
*
encoding
,
const
char
*
errors
);
static
PyObject
*
_codecs_decode
(
PyModuleDef
*
module
,
PyObject
*
args
,
PyObject
*
kwargs
)
{
PyObject
*
return_value
=
NULL
;
static
char
*
_keywords
[]
=
{
"obj"
,
"encoding"
,
"errors"
,
NULL
};
PyObject
*
obj
;
const
char
*
encoding
=
NULL
;
const
char
*
errors
=
NULL
;
if
(
!
PyArg_ParseTupleAndKeywords
(
args
,
kwargs
,
"O|ss:decode"
,
_keywords
,
&
obj
,
&
encoding
,
&
errors
))
goto
exit
;
return_value
=
_codecs_decode_impl
(
module
,
obj
,
encoding
,
errors
);
exit:
return
return_value
;
}
PyDoc_STRVAR
(
_codecs__forget_codec__doc__
,
PyDoc_STRVAR
(
_codecs__forget_codec__doc__
,
"_forget_codec($module, encoding, /)
\n
"
"_forget_codec($module, encoding, /)
\n
"
"--
\n
"
"--
\n
"
...
@@ -27,4 +142,1257 @@ _codecs__forget_codec(PyModuleDef *module, PyObject *arg)
...
@@ -27,4 +142,1257 @@ _codecs__forget_codec(PyModuleDef *module, PyObject *arg)
exit:
exit:
return
return_value
;
return
return_value
;
}
}
/*[clinic end generated code: output=52cc017e06c8ef9a input=a9049054013a1b77]*/
PyDoc_STRVAR
(
_codecs_escape_decode__doc__
,
"escape_decode($module, data, errors=None, /)
\n
"
"--
\n
"
"
\n
"
);
#define _CODECS_ESCAPE_DECODE_METHODDEF \
{"escape_decode", (PyCFunction)_codecs_escape_decode, METH_VARARGS, _codecs_escape_decode__doc__},
static
PyObject
*
_codecs_escape_decode_impl
(
PyModuleDef
*
module
,
Py_buffer
*
data
,
const
char
*
errors
);
static
PyObject
*
_codecs_escape_decode
(
PyModuleDef
*
module
,
PyObject
*
args
)
{
PyObject
*
return_value
=
NULL
;
Py_buffer
data
=
{
NULL
,
NULL
};
const
char
*
errors
=
NULL
;
if
(
!
PyArg_ParseTuple
(
args
,
"s*|z:escape_decode"
,
&
data
,
&
errors
))
goto
exit
;
return_value
=
_codecs_escape_decode_impl
(
module
,
&
data
,
errors
);
exit:
/* Cleanup for data */
if
(
data
.
obj
)
PyBuffer_Release
(
&
data
);
return
return_value
;
}
PyDoc_STRVAR
(
_codecs_escape_encode__doc__
,
"escape_encode($module, data, errors=None, /)
\n
"
"--
\n
"
"
\n
"
);
#define _CODECS_ESCAPE_ENCODE_METHODDEF \
{"escape_encode", (PyCFunction)_codecs_escape_encode, METH_VARARGS, _codecs_escape_encode__doc__},
static
PyObject
*
_codecs_escape_encode_impl
(
PyModuleDef
*
module
,
PyObject
*
data
,
const
char
*
errors
);
static
PyObject
*
_codecs_escape_encode
(
PyModuleDef
*
module
,
PyObject
*
args
)
{
PyObject
*
return_value
=
NULL
;
PyObject
*
data
;
const
char
*
errors
=
NULL
;
if
(
!
PyArg_ParseTuple
(
args
,
"O!|z:escape_encode"
,
&
PyBytes_Type
,
&
data
,
&
errors
))
goto
exit
;
return_value
=
_codecs_escape_encode_impl
(
module
,
data
,
errors
);
exit:
return
return_value
;
}
PyDoc_STRVAR
(
_codecs_unicode_internal_decode__doc__
,
"unicode_internal_decode($module, obj, errors=None, /)
\n
"
"--
\n
"
"
\n
"
);
#define _CODECS_UNICODE_INTERNAL_DECODE_METHODDEF \
{"unicode_internal_decode", (PyCFunction)_codecs_unicode_internal_decode, METH_VARARGS, _codecs_unicode_internal_decode__doc__},
static
PyObject
*
_codecs_unicode_internal_decode_impl
(
PyModuleDef
*
module
,
PyObject
*
obj
,
const
char
*
errors
);
static
PyObject
*
_codecs_unicode_internal_decode
(
PyModuleDef
*
module
,
PyObject
*
args
)
{
PyObject
*
return_value
=
NULL
;
PyObject
*
obj
;
const
char
*
errors
=
NULL
;
if
(
!
PyArg_ParseTuple
(
args
,
"O|z:unicode_internal_decode"
,
&
obj
,
&
errors
))
goto
exit
;
return_value
=
_codecs_unicode_internal_decode_impl
(
module
,
obj
,
errors
);
exit:
return
return_value
;
}
PyDoc_STRVAR
(
_codecs_utf_7_decode__doc__
,
"utf_7_decode($module, data, errors=None, final=False, /)
\n
"
"--
\n
"
"
\n
"
);
#define _CODECS_UTF_7_DECODE_METHODDEF \
{"utf_7_decode", (PyCFunction)_codecs_utf_7_decode, METH_VARARGS, _codecs_utf_7_decode__doc__},
static
PyObject
*
_codecs_utf_7_decode_impl
(
PyModuleDef
*
module
,
Py_buffer
*
data
,
const
char
*
errors
,
int
final
);
static
PyObject
*
_codecs_utf_7_decode
(
PyModuleDef
*
module
,
PyObject
*
args
)
{
PyObject
*
return_value
=
NULL
;
Py_buffer
data
=
{
NULL
,
NULL
};
const
char
*
errors
=
NULL
;
int
final
=
0
;
if
(
!
PyArg_ParseTuple
(
args
,
"y*|zi:utf_7_decode"
,
&
data
,
&
errors
,
&
final
))
goto
exit
;
return_value
=
_codecs_utf_7_decode_impl
(
module
,
&
data
,
errors
,
final
);
exit:
/* Cleanup for data */
if
(
data
.
obj
)
PyBuffer_Release
(
&
data
);
return
return_value
;
}
PyDoc_STRVAR
(
_codecs_utf_8_decode__doc__
,
"utf_8_decode($module, data, errors=None, final=False, /)
\n
"
"--
\n
"
"
\n
"
);
#define _CODECS_UTF_8_DECODE_METHODDEF \
{"utf_8_decode", (PyCFunction)_codecs_utf_8_decode, METH_VARARGS, _codecs_utf_8_decode__doc__},
static
PyObject
*
_codecs_utf_8_decode_impl
(
PyModuleDef
*
module
,
Py_buffer
*
data
,
const
char
*
errors
,
int
final
);
static
PyObject
*
_codecs_utf_8_decode
(
PyModuleDef
*
module
,
PyObject
*
args
)
{
PyObject
*
return_value
=
NULL
;
Py_buffer
data
=
{
NULL
,
NULL
};
const
char
*
errors
=
NULL
;
int
final
=
0
;
if
(
!
PyArg_ParseTuple
(
args
,
"y*|zi:utf_8_decode"
,
&
data
,
&
errors
,
&
final
))
goto
exit
;
return_value
=
_codecs_utf_8_decode_impl
(
module
,
&
data
,
errors
,
final
);
exit:
/* Cleanup for data */
if
(
data
.
obj
)
PyBuffer_Release
(
&
data
);
return
return_value
;
}
PyDoc_STRVAR
(
_codecs_utf_16_decode__doc__
,
"utf_16_decode($module, data, errors=None, final=False, /)
\n
"
"--
\n
"
"
\n
"
);
#define _CODECS_UTF_16_DECODE_METHODDEF \
{"utf_16_decode", (PyCFunction)_codecs_utf_16_decode, METH_VARARGS, _codecs_utf_16_decode__doc__},
static
PyObject
*
_codecs_utf_16_decode_impl
(
PyModuleDef
*
module
,
Py_buffer
*
data
,
const
char
*
errors
,
int
final
);
static
PyObject
*
_codecs_utf_16_decode
(
PyModuleDef
*
module
,
PyObject
*
args
)
{
PyObject
*
return_value
=
NULL
;
Py_buffer
data
=
{
NULL
,
NULL
};
const
char
*
errors
=
NULL
;
int
final
=
0
;
if
(
!
PyArg_ParseTuple
(
args
,
"y*|zi:utf_16_decode"
,
&
data
,
&
errors
,
&
final
))
goto
exit
;
return_value
=
_codecs_utf_16_decode_impl
(
module
,
&
data
,
errors
,
final
);
exit:
/* Cleanup for data */
if
(
data
.
obj
)
PyBuffer_Release
(
&
data
);
return
return_value
;
}
PyDoc_STRVAR
(
_codecs_utf_16_le_decode__doc__
,
"utf_16_le_decode($module, data, errors=None, final=False, /)
\n
"
"--
\n
"
"
\n
"
);
#define _CODECS_UTF_16_LE_DECODE_METHODDEF \
{"utf_16_le_decode", (PyCFunction)_codecs_utf_16_le_decode, METH_VARARGS, _codecs_utf_16_le_decode__doc__},
static
PyObject
*
_codecs_utf_16_le_decode_impl
(
PyModuleDef
*
module
,
Py_buffer
*
data
,
const
char
*
errors
,
int
final
);
static
PyObject
*
_codecs_utf_16_le_decode
(
PyModuleDef
*
module
,
PyObject
*
args
)
{
PyObject
*
return_value
=
NULL
;
Py_buffer
data
=
{
NULL
,
NULL
};
const
char
*
errors
=
NULL
;
int
final
=
0
;
if
(
!
PyArg_ParseTuple
(
args
,
"y*|zi:utf_16_le_decode"
,
&
data
,
&
errors
,
&
final
))
goto
exit
;
return_value
=
_codecs_utf_16_le_decode_impl
(
module
,
&
data
,
errors
,
final
);
exit:
/* Cleanup for data */
if
(
data
.
obj
)
PyBuffer_Release
(
&
data
);
return
return_value
;
}
PyDoc_STRVAR
(
_codecs_utf_16_be_decode__doc__
,
"utf_16_be_decode($module, data, errors=None, final=False, /)
\n
"
"--
\n
"
"
\n
"
);
#define _CODECS_UTF_16_BE_DECODE_METHODDEF \
{"utf_16_be_decode", (PyCFunction)_codecs_utf_16_be_decode, METH_VARARGS, _codecs_utf_16_be_decode__doc__},
static
PyObject
*
_codecs_utf_16_be_decode_impl
(
PyModuleDef
*
module
,
Py_buffer
*
data
,
const
char
*
errors
,
int
final
);
static
PyObject
*
_codecs_utf_16_be_decode
(
PyModuleDef
*
module
,
PyObject
*
args
)
{
PyObject
*
return_value
=
NULL
;
Py_buffer
data
=
{
NULL
,
NULL
};
const
char
*
errors
=
NULL
;
int
final
=
0
;
if
(
!
PyArg_ParseTuple
(
args
,
"y*|zi:utf_16_be_decode"
,
&
data
,
&
errors
,
&
final
))
goto
exit
;
return_value
=
_codecs_utf_16_be_decode_impl
(
module
,
&
data
,
errors
,
final
);
exit:
/* Cleanup for data */
if
(
data
.
obj
)
PyBuffer_Release
(
&
data
);
return
return_value
;
}
PyDoc_STRVAR
(
_codecs_utf_16_ex_decode__doc__
,
"utf_16_ex_decode($module, data, errors=None, byteorder=0, final=False,
\n
"
" /)
\n
"
"--
\n
"
"
\n
"
);
#define _CODECS_UTF_16_EX_DECODE_METHODDEF \
{"utf_16_ex_decode", (PyCFunction)_codecs_utf_16_ex_decode, METH_VARARGS, _codecs_utf_16_ex_decode__doc__},
static
PyObject
*
_codecs_utf_16_ex_decode_impl
(
PyModuleDef
*
module
,
Py_buffer
*
data
,
const
char
*
errors
,
int
byteorder
,
int
final
);
static
PyObject
*
_codecs_utf_16_ex_decode
(
PyModuleDef
*
module
,
PyObject
*
args
)
{
PyObject
*
return_value
=
NULL
;
Py_buffer
data
=
{
NULL
,
NULL
};
const
char
*
errors
=
NULL
;
int
byteorder
=
0
;
int
final
=
0
;
if
(
!
PyArg_ParseTuple
(
args
,
"y*|zii:utf_16_ex_decode"
,
&
data
,
&
errors
,
&
byteorder
,
&
final
))
goto
exit
;
return_value
=
_codecs_utf_16_ex_decode_impl
(
module
,
&
data
,
errors
,
byteorder
,
final
);
exit:
/* Cleanup for data */
if
(
data
.
obj
)
PyBuffer_Release
(
&
data
);
return
return_value
;
}
PyDoc_STRVAR
(
_codecs_utf_32_decode__doc__
,
"utf_32_decode($module, data, errors=None, final=False, /)
\n
"
"--
\n
"
"
\n
"
);
#define _CODECS_UTF_32_DECODE_METHODDEF \
{"utf_32_decode", (PyCFunction)_codecs_utf_32_decode, METH_VARARGS, _codecs_utf_32_decode__doc__},
static
PyObject
*
_codecs_utf_32_decode_impl
(
PyModuleDef
*
module
,
Py_buffer
*
data
,
const
char
*
errors
,
int
final
);
static
PyObject
*
_codecs_utf_32_decode
(
PyModuleDef
*
module
,
PyObject
*
args
)
{
PyObject
*
return_value
=
NULL
;
Py_buffer
data
=
{
NULL
,
NULL
};
const
char
*
errors
=
NULL
;
int
final
=
0
;
if
(
!
PyArg_ParseTuple
(
args
,
"y*|zi:utf_32_decode"
,
&
data
,
&
errors
,
&
final
))
goto
exit
;
return_value
=
_codecs_utf_32_decode_impl
(
module
,
&
data
,
errors
,
final
);
exit:
/* Cleanup for data */
if
(
data
.
obj
)
PyBuffer_Release
(
&
data
);
return
return_value
;
}
PyDoc_STRVAR
(
_codecs_utf_32_le_decode__doc__
,
"utf_32_le_decode($module, data, errors=None, final=False, /)
\n
"
"--
\n
"
"
\n
"
);
#define _CODECS_UTF_32_LE_DECODE_METHODDEF \
{"utf_32_le_decode", (PyCFunction)_codecs_utf_32_le_decode, METH_VARARGS, _codecs_utf_32_le_decode__doc__},
static
PyObject
*
_codecs_utf_32_le_decode_impl
(
PyModuleDef
*
module
,
Py_buffer
*
data
,
const
char
*
errors
,
int
final
);
static
PyObject
*
_codecs_utf_32_le_decode
(
PyModuleDef
*
module
,
PyObject
*
args
)
{
PyObject
*
return_value
=
NULL
;
Py_buffer
data
=
{
NULL
,
NULL
};
const
char
*
errors
=
NULL
;
int
final
=
0
;
if
(
!
PyArg_ParseTuple
(
args
,
"y*|zi:utf_32_le_decode"
,
&
data
,
&
errors
,
&
final
))
goto
exit
;
return_value
=
_codecs_utf_32_le_decode_impl
(
module
,
&
data
,
errors
,
final
);
exit:
/* Cleanup for data */
if
(
data
.
obj
)
PyBuffer_Release
(
&
data
);
return
return_value
;
}
PyDoc_STRVAR
(
_codecs_utf_32_be_decode__doc__
,
"utf_32_be_decode($module, data, errors=None, final=False, /)
\n
"
"--
\n
"
"
\n
"
);
#define _CODECS_UTF_32_BE_DECODE_METHODDEF \
{"utf_32_be_decode", (PyCFunction)_codecs_utf_32_be_decode, METH_VARARGS, _codecs_utf_32_be_decode__doc__},
static
PyObject
*
_codecs_utf_32_be_decode_impl
(
PyModuleDef
*
module
,
Py_buffer
*
data
,
const
char
*
errors
,
int
final
);
static
PyObject
*
_codecs_utf_32_be_decode
(
PyModuleDef
*
module
,
PyObject
*
args
)
{
PyObject
*
return_value
=
NULL
;
Py_buffer
data
=
{
NULL
,
NULL
};
const
char
*
errors
=
NULL
;
int
final
=
0
;
if
(
!
PyArg_ParseTuple
(
args
,
"y*|zi:utf_32_be_decode"
,
&
data
,
&
errors
,
&
final
))
goto
exit
;
return_value
=
_codecs_utf_32_be_decode_impl
(
module
,
&
data
,
errors
,
final
);
exit:
/* Cleanup for data */
if
(
data
.
obj
)
PyBuffer_Release
(
&
data
);
return
return_value
;
}
PyDoc_STRVAR
(
_codecs_utf_32_ex_decode__doc__
,
"utf_32_ex_decode($module, data, errors=None, byteorder=0, final=False,
\n
"
" /)
\n
"
"--
\n
"
"
\n
"
);
#define _CODECS_UTF_32_EX_DECODE_METHODDEF \
{"utf_32_ex_decode", (PyCFunction)_codecs_utf_32_ex_decode, METH_VARARGS, _codecs_utf_32_ex_decode__doc__},
static
PyObject
*
_codecs_utf_32_ex_decode_impl
(
PyModuleDef
*
module
,
Py_buffer
*
data
,
const
char
*
errors
,
int
byteorder
,
int
final
);
static
PyObject
*
_codecs_utf_32_ex_decode
(
PyModuleDef
*
module
,
PyObject
*
args
)
{
PyObject
*
return_value
=
NULL
;
Py_buffer
data
=
{
NULL
,
NULL
};
const
char
*
errors
=
NULL
;
int
byteorder
=
0
;
int
final
=
0
;
if
(
!
PyArg_ParseTuple
(
args
,
"y*|zii:utf_32_ex_decode"
,
&
data
,
&
errors
,
&
byteorder
,
&
final
))
goto
exit
;
return_value
=
_codecs_utf_32_ex_decode_impl
(
module
,
&
data
,
errors
,
byteorder
,
final
);
exit:
/* Cleanup for data */
if
(
data
.
obj
)
PyBuffer_Release
(
&
data
);
return
return_value
;
}
PyDoc_STRVAR
(
_codecs_unicode_escape_decode__doc__
,
"unicode_escape_decode($module, data, errors=None, /)
\n
"
"--
\n
"
"
\n
"
);
#define _CODECS_UNICODE_ESCAPE_DECODE_METHODDEF \
{"unicode_escape_decode", (PyCFunction)_codecs_unicode_escape_decode, METH_VARARGS, _codecs_unicode_escape_decode__doc__},
static
PyObject
*
_codecs_unicode_escape_decode_impl
(
PyModuleDef
*
module
,
Py_buffer
*
data
,
const
char
*
errors
);
static
PyObject
*
_codecs_unicode_escape_decode
(
PyModuleDef
*
module
,
PyObject
*
args
)
{
PyObject
*
return_value
=
NULL
;
Py_buffer
data
=
{
NULL
,
NULL
};
const
char
*
errors
=
NULL
;
if
(
!
PyArg_ParseTuple
(
args
,
"s*|z:unicode_escape_decode"
,
&
data
,
&
errors
))
goto
exit
;
return_value
=
_codecs_unicode_escape_decode_impl
(
module
,
&
data
,
errors
);
exit:
/* Cleanup for data */
if
(
data
.
obj
)
PyBuffer_Release
(
&
data
);
return
return_value
;
}
PyDoc_STRVAR
(
_codecs_raw_unicode_escape_decode__doc__
,
"raw_unicode_escape_decode($module, data, errors=None, /)
\n
"
"--
\n
"
"
\n
"
);
#define _CODECS_RAW_UNICODE_ESCAPE_DECODE_METHODDEF \
{"raw_unicode_escape_decode", (PyCFunction)_codecs_raw_unicode_escape_decode, METH_VARARGS, _codecs_raw_unicode_escape_decode__doc__},
static
PyObject
*
_codecs_raw_unicode_escape_decode_impl
(
PyModuleDef
*
module
,
Py_buffer
*
data
,
const
char
*
errors
);
static
PyObject
*
_codecs_raw_unicode_escape_decode
(
PyModuleDef
*
module
,
PyObject
*
args
)
{
PyObject
*
return_value
=
NULL
;
Py_buffer
data
=
{
NULL
,
NULL
};
const
char
*
errors
=
NULL
;
if
(
!
PyArg_ParseTuple
(
args
,
"s*|z:raw_unicode_escape_decode"
,
&
data
,
&
errors
))
goto
exit
;
return_value
=
_codecs_raw_unicode_escape_decode_impl
(
module
,
&
data
,
errors
);
exit:
/* Cleanup for data */
if
(
data
.
obj
)
PyBuffer_Release
(
&
data
);
return
return_value
;
}
PyDoc_STRVAR
(
_codecs_latin_1_decode__doc__
,
"latin_1_decode($module, data, errors=None, /)
\n
"
"--
\n
"
"
\n
"
);
#define _CODECS_LATIN_1_DECODE_METHODDEF \
{"latin_1_decode", (PyCFunction)_codecs_latin_1_decode, METH_VARARGS, _codecs_latin_1_decode__doc__},
static
PyObject
*
_codecs_latin_1_decode_impl
(
PyModuleDef
*
module
,
Py_buffer
*
data
,
const
char
*
errors
);
static
PyObject
*
_codecs_latin_1_decode
(
PyModuleDef
*
module
,
PyObject
*
args
)
{
PyObject
*
return_value
=
NULL
;
Py_buffer
data
=
{
NULL
,
NULL
};
const
char
*
errors
=
NULL
;
if
(
!
PyArg_ParseTuple
(
args
,
"y*|z:latin_1_decode"
,
&
data
,
&
errors
))
goto
exit
;
return_value
=
_codecs_latin_1_decode_impl
(
module
,
&
data
,
errors
);
exit:
/* Cleanup for data */
if
(
data
.
obj
)
PyBuffer_Release
(
&
data
);
return
return_value
;
}
PyDoc_STRVAR
(
_codecs_ascii_decode__doc__
,
"ascii_decode($module, data, errors=None, /)
\n
"
"--
\n
"
"
\n
"
);
#define _CODECS_ASCII_DECODE_METHODDEF \
{"ascii_decode", (PyCFunction)_codecs_ascii_decode, METH_VARARGS, _codecs_ascii_decode__doc__},
static
PyObject
*
_codecs_ascii_decode_impl
(
PyModuleDef
*
module
,
Py_buffer
*
data
,
const
char
*
errors
);
static
PyObject
*
_codecs_ascii_decode
(
PyModuleDef
*
module
,
PyObject
*
args
)
{
PyObject
*
return_value
=
NULL
;
Py_buffer
data
=
{
NULL
,
NULL
};
const
char
*
errors
=
NULL
;
if
(
!
PyArg_ParseTuple
(
args
,
"y*|z:ascii_decode"
,
&
data
,
&
errors
))
goto
exit
;
return_value
=
_codecs_ascii_decode_impl
(
module
,
&
data
,
errors
);
exit:
/* Cleanup for data */
if
(
data
.
obj
)
PyBuffer_Release
(
&
data
);
return
return_value
;
}
PyDoc_STRVAR
(
_codecs_charmap_decode__doc__
,
"charmap_decode($module, data, errors=None, mapping=None, /)
\n
"
"--
\n
"
"
\n
"
);
#define _CODECS_CHARMAP_DECODE_METHODDEF \
{"charmap_decode", (PyCFunction)_codecs_charmap_decode, METH_VARARGS, _codecs_charmap_decode__doc__},
static
PyObject
*
_codecs_charmap_decode_impl
(
PyModuleDef
*
module
,
Py_buffer
*
data
,
const
char
*
errors
,
PyObject
*
mapping
);
static
PyObject
*
_codecs_charmap_decode
(
PyModuleDef
*
module
,
PyObject
*
args
)
{
PyObject
*
return_value
=
NULL
;
Py_buffer
data
=
{
NULL
,
NULL
};
const
char
*
errors
=
NULL
;
PyObject
*
mapping
=
NULL
;
if
(
!
PyArg_ParseTuple
(
args
,
"y*|zO:charmap_decode"
,
&
data
,
&
errors
,
&
mapping
))
goto
exit
;
return_value
=
_codecs_charmap_decode_impl
(
module
,
&
data
,
errors
,
mapping
);
exit:
/* Cleanup for data */
if
(
data
.
obj
)
PyBuffer_Release
(
&
data
);
return
return_value
;
}
#if defined(HAVE_MBCS)
PyDoc_STRVAR
(
_codecs_mbcs_decode__doc__
,
"mbcs_decode($module, data, errors=None, final=False, /)
\n
"
"--
\n
"
"
\n
"
);
#define _CODECS_MBCS_DECODE_METHODDEF \
{"mbcs_decode", (PyCFunction)_codecs_mbcs_decode, METH_VARARGS, _codecs_mbcs_decode__doc__},
static
PyObject
*
_codecs_mbcs_decode_impl
(
PyModuleDef
*
module
,
Py_buffer
*
data
,
const
char
*
errors
,
int
final
);
static
PyObject
*
_codecs_mbcs_decode
(
PyModuleDef
*
module
,
PyObject
*
args
)
{
PyObject
*
return_value
=
NULL
;
Py_buffer
data
=
{
NULL
,
NULL
};
const
char
*
errors
=
NULL
;
int
final
=
0
;
if
(
!
PyArg_ParseTuple
(
args
,
"y*|zi:mbcs_decode"
,
&
data
,
&
errors
,
&
final
))
goto
exit
;
return_value
=
_codecs_mbcs_decode_impl
(
module
,
&
data
,
errors
,
final
);
exit:
/* Cleanup for data */
if
(
data
.
obj
)
PyBuffer_Release
(
&
data
);
return
return_value
;
}
#endif
/* defined(HAVE_MBCS) */
#if defined(HAVE_MBCS)
PyDoc_STRVAR
(
_codecs_code_page_decode__doc__
,
"code_page_decode($module, codepage, data, errors=None, final=False, /)
\n
"
"--
\n
"
"
\n
"
);
#define _CODECS_CODE_PAGE_DECODE_METHODDEF \
{"code_page_decode", (PyCFunction)_codecs_code_page_decode, METH_VARARGS, _codecs_code_page_decode__doc__},
static
PyObject
*
_codecs_code_page_decode_impl
(
PyModuleDef
*
module
,
int
codepage
,
Py_buffer
*
data
,
const
char
*
errors
,
int
final
);
static
PyObject
*
_codecs_code_page_decode
(
PyModuleDef
*
module
,
PyObject
*
args
)
{
PyObject
*
return_value
=
NULL
;
int
codepage
;
Py_buffer
data
=
{
NULL
,
NULL
};
const
char
*
errors
=
NULL
;
int
final
=
0
;
if
(
!
PyArg_ParseTuple
(
args
,
"iy*|zi:code_page_decode"
,
&
codepage
,
&
data
,
&
errors
,
&
final
))
goto
exit
;
return_value
=
_codecs_code_page_decode_impl
(
module
,
codepage
,
&
data
,
errors
,
final
);
exit:
/* Cleanup for data */
if
(
data
.
obj
)
PyBuffer_Release
(
&
data
);
return
return_value
;
}
#endif
/* defined(HAVE_MBCS) */
PyDoc_STRVAR
(
_codecs_readbuffer_encode__doc__
,
"readbuffer_encode($module, data, errors=None, /)
\n
"
"--
\n
"
"
\n
"
);
#define _CODECS_READBUFFER_ENCODE_METHODDEF \
{"readbuffer_encode", (PyCFunction)_codecs_readbuffer_encode, METH_VARARGS, _codecs_readbuffer_encode__doc__},
static
PyObject
*
_codecs_readbuffer_encode_impl
(
PyModuleDef
*
module
,
Py_buffer
*
data
,
const
char
*
errors
);
static
PyObject
*
_codecs_readbuffer_encode
(
PyModuleDef
*
module
,
PyObject
*
args
)
{
PyObject
*
return_value
=
NULL
;
Py_buffer
data
=
{
NULL
,
NULL
};
const
char
*
errors
=
NULL
;
if
(
!
PyArg_ParseTuple
(
args
,
"s*|z:readbuffer_encode"
,
&
data
,
&
errors
))
goto
exit
;
return_value
=
_codecs_readbuffer_encode_impl
(
module
,
&
data
,
errors
);
exit:
/* Cleanup for data */
if
(
data
.
obj
)
PyBuffer_Release
(
&
data
);
return
return_value
;
}
PyDoc_STRVAR
(
_codecs_unicode_internal_encode__doc__
,
"unicode_internal_encode($module, obj, errors=None, /)
\n
"
"--
\n
"
"
\n
"
);
#define _CODECS_UNICODE_INTERNAL_ENCODE_METHODDEF \
{"unicode_internal_encode", (PyCFunction)_codecs_unicode_internal_encode, METH_VARARGS, _codecs_unicode_internal_encode__doc__},
static
PyObject
*
_codecs_unicode_internal_encode_impl
(
PyModuleDef
*
module
,
PyObject
*
obj
,
const
char
*
errors
);
static
PyObject
*
_codecs_unicode_internal_encode
(
PyModuleDef
*
module
,
PyObject
*
args
)
{
PyObject
*
return_value
=
NULL
;
PyObject
*
obj
;
const
char
*
errors
=
NULL
;
if
(
!
PyArg_ParseTuple
(
args
,
"O|z:unicode_internal_encode"
,
&
obj
,
&
errors
))
goto
exit
;
return_value
=
_codecs_unicode_internal_encode_impl
(
module
,
obj
,
errors
);
exit:
return
return_value
;
}
PyDoc_STRVAR
(
_codecs_utf_7_encode__doc__
,
"utf_7_encode($module, str, errors=None, /)
\n
"
"--
\n
"
"
\n
"
);
#define _CODECS_UTF_7_ENCODE_METHODDEF \
{"utf_7_encode", (PyCFunction)_codecs_utf_7_encode, METH_VARARGS, _codecs_utf_7_encode__doc__},
static
PyObject
*
_codecs_utf_7_encode_impl
(
PyModuleDef
*
module
,
PyObject
*
str
,
const
char
*
errors
);
static
PyObject
*
_codecs_utf_7_encode
(
PyModuleDef
*
module
,
PyObject
*
args
)
{
PyObject
*
return_value
=
NULL
;
PyObject
*
str
;
const
char
*
errors
=
NULL
;
if
(
!
PyArg_ParseTuple
(
args
,
"O|z:utf_7_encode"
,
&
str
,
&
errors
))
goto
exit
;
return_value
=
_codecs_utf_7_encode_impl
(
module
,
str
,
errors
);
exit:
return
return_value
;
}
PyDoc_STRVAR
(
_codecs_utf_8_encode__doc__
,
"utf_8_encode($module, str, errors=None, /)
\n
"
"--
\n
"
"
\n
"
);
#define _CODECS_UTF_8_ENCODE_METHODDEF \
{"utf_8_encode", (PyCFunction)_codecs_utf_8_encode, METH_VARARGS, _codecs_utf_8_encode__doc__},
static
PyObject
*
_codecs_utf_8_encode_impl
(
PyModuleDef
*
module
,
PyObject
*
str
,
const
char
*
errors
);
static
PyObject
*
_codecs_utf_8_encode
(
PyModuleDef
*
module
,
PyObject
*
args
)
{
PyObject
*
return_value
=
NULL
;
PyObject
*
str
;
const
char
*
errors
=
NULL
;
if
(
!
PyArg_ParseTuple
(
args
,
"O|z:utf_8_encode"
,
&
str
,
&
errors
))
goto
exit
;
return_value
=
_codecs_utf_8_encode_impl
(
module
,
str
,
errors
);
exit:
return
return_value
;
}
PyDoc_STRVAR
(
_codecs_utf_16_encode__doc__
,
"utf_16_encode($module, str, errors=None, byteorder=0, /)
\n
"
"--
\n
"
"
\n
"
);
#define _CODECS_UTF_16_ENCODE_METHODDEF \
{"utf_16_encode", (PyCFunction)_codecs_utf_16_encode, METH_VARARGS, _codecs_utf_16_encode__doc__},
static
PyObject
*
_codecs_utf_16_encode_impl
(
PyModuleDef
*
module
,
PyObject
*
str
,
const
char
*
errors
,
int
byteorder
);
static
PyObject
*
_codecs_utf_16_encode
(
PyModuleDef
*
module
,
PyObject
*
args
)
{
PyObject
*
return_value
=
NULL
;
PyObject
*
str
;
const
char
*
errors
=
NULL
;
int
byteorder
=
0
;
if
(
!
PyArg_ParseTuple
(
args
,
"O|zi:utf_16_encode"
,
&
str
,
&
errors
,
&
byteorder
))
goto
exit
;
return_value
=
_codecs_utf_16_encode_impl
(
module
,
str
,
errors
,
byteorder
);
exit:
return
return_value
;
}
PyDoc_STRVAR
(
_codecs_utf_16_le_encode__doc__
,
"utf_16_le_encode($module, str, errors=None, /)
\n
"
"--
\n
"
"
\n
"
);
#define _CODECS_UTF_16_LE_ENCODE_METHODDEF \
{"utf_16_le_encode", (PyCFunction)_codecs_utf_16_le_encode, METH_VARARGS, _codecs_utf_16_le_encode__doc__},
static
PyObject
*
_codecs_utf_16_le_encode_impl
(
PyModuleDef
*
module
,
PyObject
*
str
,
const
char
*
errors
);
static
PyObject
*
_codecs_utf_16_le_encode
(
PyModuleDef
*
module
,
PyObject
*
args
)
{
PyObject
*
return_value
=
NULL
;
PyObject
*
str
;
const
char
*
errors
=
NULL
;
if
(
!
PyArg_ParseTuple
(
args
,
"O|z:utf_16_le_encode"
,
&
str
,
&
errors
))
goto
exit
;
return_value
=
_codecs_utf_16_le_encode_impl
(
module
,
str
,
errors
);
exit:
return
return_value
;
}
PyDoc_STRVAR
(
_codecs_utf_16_be_encode__doc__
,
"utf_16_be_encode($module, str, errors=None, /)
\n
"
"--
\n
"
"
\n
"
);
#define _CODECS_UTF_16_BE_ENCODE_METHODDEF \
{"utf_16_be_encode", (PyCFunction)_codecs_utf_16_be_encode, METH_VARARGS, _codecs_utf_16_be_encode__doc__},
static
PyObject
*
_codecs_utf_16_be_encode_impl
(
PyModuleDef
*
module
,
PyObject
*
str
,
const
char
*
errors
);
static
PyObject
*
_codecs_utf_16_be_encode
(
PyModuleDef
*
module
,
PyObject
*
args
)
{
PyObject
*
return_value
=
NULL
;
PyObject
*
str
;
const
char
*
errors
=
NULL
;
if
(
!
PyArg_ParseTuple
(
args
,
"O|z:utf_16_be_encode"
,
&
str
,
&
errors
))
goto
exit
;
return_value
=
_codecs_utf_16_be_encode_impl
(
module
,
str
,
errors
);
exit:
return
return_value
;
}
PyDoc_STRVAR
(
_codecs_utf_32_encode__doc__
,
"utf_32_encode($module, str, errors=None, byteorder=0, /)
\n
"
"--
\n
"
"
\n
"
);
#define _CODECS_UTF_32_ENCODE_METHODDEF \
{"utf_32_encode", (PyCFunction)_codecs_utf_32_encode, METH_VARARGS, _codecs_utf_32_encode__doc__},
static
PyObject
*
_codecs_utf_32_encode_impl
(
PyModuleDef
*
module
,
PyObject
*
str
,
const
char
*
errors
,
int
byteorder
);
static
PyObject
*
_codecs_utf_32_encode
(
PyModuleDef
*
module
,
PyObject
*
args
)
{
PyObject
*
return_value
=
NULL
;
PyObject
*
str
;
const
char
*
errors
=
NULL
;
int
byteorder
=
0
;
if
(
!
PyArg_ParseTuple
(
args
,
"O|zi:utf_32_encode"
,
&
str
,
&
errors
,
&
byteorder
))
goto
exit
;
return_value
=
_codecs_utf_32_encode_impl
(
module
,
str
,
errors
,
byteorder
);
exit:
return
return_value
;
}
PyDoc_STRVAR
(
_codecs_utf_32_le_encode__doc__
,
"utf_32_le_encode($module, str, errors=None, /)
\n
"
"--
\n
"
"
\n
"
);
#define _CODECS_UTF_32_LE_ENCODE_METHODDEF \
{"utf_32_le_encode", (PyCFunction)_codecs_utf_32_le_encode, METH_VARARGS, _codecs_utf_32_le_encode__doc__},
static
PyObject
*
_codecs_utf_32_le_encode_impl
(
PyModuleDef
*
module
,
PyObject
*
str
,
const
char
*
errors
);
static
PyObject
*
_codecs_utf_32_le_encode
(
PyModuleDef
*
module
,
PyObject
*
args
)
{
PyObject
*
return_value
=
NULL
;
PyObject
*
str
;
const
char
*
errors
=
NULL
;
if
(
!
PyArg_ParseTuple
(
args
,
"O|z:utf_32_le_encode"
,
&
str
,
&
errors
))
goto
exit
;
return_value
=
_codecs_utf_32_le_encode_impl
(
module
,
str
,
errors
);
exit:
return
return_value
;
}
PyDoc_STRVAR
(
_codecs_utf_32_be_encode__doc__
,
"utf_32_be_encode($module, str, errors=None, /)
\n
"
"--
\n
"
"
\n
"
);
#define _CODECS_UTF_32_BE_ENCODE_METHODDEF \
{"utf_32_be_encode", (PyCFunction)_codecs_utf_32_be_encode, METH_VARARGS, _codecs_utf_32_be_encode__doc__},
static
PyObject
*
_codecs_utf_32_be_encode_impl
(
PyModuleDef
*
module
,
PyObject
*
str
,
const
char
*
errors
);
static
PyObject
*
_codecs_utf_32_be_encode
(
PyModuleDef
*
module
,
PyObject
*
args
)
{
PyObject
*
return_value
=
NULL
;
PyObject
*
str
;
const
char
*
errors
=
NULL
;
if
(
!
PyArg_ParseTuple
(
args
,
"O|z:utf_32_be_encode"
,
&
str
,
&
errors
))
goto
exit
;
return_value
=
_codecs_utf_32_be_encode_impl
(
module
,
str
,
errors
);
exit:
return
return_value
;
}
PyDoc_STRVAR
(
_codecs_unicode_escape_encode__doc__
,
"unicode_escape_encode($module, str, errors=None, /)
\n
"
"--
\n
"
"
\n
"
);
#define _CODECS_UNICODE_ESCAPE_ENCODE_METHODDEF \
{"unicode_escape_encode", (PyCFunction)_codecs_unicode_escape_encode, METH_VARARGS, _codecs_unicode_escape_encode__doc__},
static
PyObject
*
_codecs_unicode_escape_encode_impl
(
PyModuleDef
*
module
,
PyObject
*
str
,
const
char
*
errors
);
static
PyObject
*
_codecs_unicode_escape_encode
(
PyModuleDef
*
module
,
PyObject
*
args
)
{
PyObject
*
return_value
=
NULL
;
PyObject
*
str
;
const
char
*
errors
=
NULL
;
if
(
!
PyArg_ParseTuple
(
args
,
"O|z:unicode_escape_encode"
,
&
str
,
&
errors
))
goto
exit
;
return_value
=
_codecs_unicode_escape_encode_impl
(
module
,
str
,
errors
);
exit:
return
return_value
;
}
PyDoc_STRVAR
(
_codecs_raw_unicode_escape_encode__doc__
,
"raw_unicode_escape_encode($module, str, errors=None, /)
\n
"
"--
\n
"
"
\n
"
);
#define _CODECS_RAW_UNICODE_ESCAPE_ENCODE_METHODDEF \
{"raw_unicode_escape_encode", (PyCFunction)_codecs_raw_unicode_escape_encode, METH_VARARGS, _codecs_raw_unicode_escape_encode__doc__},
static
PyObject
*
_codecs_raw_unicode_escape_encode_impl
(
PyModuleDef
*
module
,
PyObject
*
str
,
const
char
*
errors
);
static
PyObject
*
_codecs_raw_unicode_escape_encode
(
PyModuleDef
*
module
,
PyObject
*
args
)
{
PyObject
*
return_value
=
NULL
;
PyObject
*
str
;
const
char
*
errors
=
NULL
;
if
(
!
PyArg_ParseTuple
(
args
,
"O|z:raw_unicode_escape_encode"
,
&
str
,
&
errors
))
goto
exit
;
return_value
=
_codecs_raw_unicode_escape_encode_impl
(
module
,
str
,
errors
);
exit:
return
return_value
;
}
PyDoc_STRVAR
(
_codecs_latin_1_encode__doc__
,
"latin_1_encode($module, str, errors=None, /)
\n
"
"--
\n
"
"
\n
"
);
#define _CODECS_LATIN_1_ENCODE_METHODDEF \
{"latin_1_encode", (PyCFunction)_codecs_latin_1_encode, METH_VARARGS, _codecs_latin_1_encode__doc__},
static
PyObject
*
_codecs_latin_1_encode_impl
(
PyModuleDef
*
module
,
PyObject
*
str
,
const
char
*
errors
);
static
PyObject
*
_codecs_latin_1_encode
(
PyModuleDef
*
module
,
PyObject
*
args
)
{
PyObject
*
return_value
=
NULL
;
PyObject
*
str
;
const
char
*
errors
=
NULL
;
if
(
!
PyArg_ParseTuple
(
args
,
"O|z:latin_1_encode"
,
&
str
,
&
errors
))
goto
exit
;
return_value
=
_codecs_latin_1_encode_impl
(
module
,
str
,
errors
);
exit:
return
return_value
;
}
PyDoc_STRVAR
(
_codecs_ascii_encode__doc__
,
"ascii_encode($module, str, errors=None, /)
\n
"
"--
\n
"
"
\n
"
);
#define _CODECS_ASCII_ENCODE_METHODDEF \
{"ascii_encode", (PyCFunction)_codecs_ascii_encode, METH_VARARGS, _codecs_ascii_encode__doc__},
static
PyObject
*
_codecs_ascii_encode_impl
(
PyModuleDef
*
module
,
PyObject
*
str
,
const
char
*
errors
);
static
PyObject
*
_codecs_ascii_encode
(
PyModuleDef
*
module
,
PyObject
*
args
)
{
PyObject
*
return_value
=
NULL
;
PyObject
*
str
;
const
char
*
errors
=
NULL
;
if
(
!
PyArg_ParseTuple
(
args
,
"O|z:ascii_encode"
,
&
str
,
&
errors
))
goto
exit
;
return_value
=
_codecs_ascii_encode_impl
(
module
,
str
,
errors
);
exit:
return
return_value
;
}
PyDoc_STRVAR
(
_codecs_charmap_encode__doc__
,
"charmap_encode($module, str, errors=None, mapping=None, /)
\n
"
"--
\n
"
"
\n
"
);
#define _CODECS_CHARMAP_ENCODE_METHODDEF \
{"charmap_encode", (PyCFunction)_codecs_charmap_encode, METH_VARARGS, _codecs_charmap_encode__doc__},
static
PyObject
*
_codecs_charmap_encode_impl
(
PyModuleDef
*
module
,
PyObject
*
str
,
const
char
*
errors
,
PyObject
*
mapping
);
static
PyObject
*
_codecs_charmap_encode
(
PyModuleDef
*
module
,
PyObject
*
args
)
{
PyObject
*
return_value
=
NULL
;
PyObject
*
str
;
const
char
*
errors
=
NULL
;
PyObject
*
mapping
=
NULL
;
if
(
!
PyArg_ParseTuple
(
args
,
"O|zO:charmap_encode"
,
&
str
,
&
errors
,
&
mapping
))
goto
exit
;
return_value
=
_codecs_charmap_encode_impl
(
module
,
str
,
errors
,
mapping
);
exit:
return
return_value
;
}
PyDoc_STRVAR
(
_codecs_charmap_build__doc__
,
"charmap_build($module, map, /)
\n
"
"--
\n
"
"
\n
"
);
#define _CODECS_CHARMAP_BUILD_METHODDEF \
{"charmap_build", (PyCFunction)_codecs_charmap_build, METH_O, _codecs_charmap_build__doc__},
static
PyObject
*
_codecs_charmap_build_impl
(
PyModuleDef
*
module
,
PyObject
*
map
);
static
PyObject
*
_codecs_charmap_build
(
PyModuleDef
*
module
,
PyObject
*
arg
)
{
PyObject
*
return_value
=
NULL
;
PyObject
*
map
;
if
(
!
PyArg_Parse
(
arg
,
"U:charmap_build"
,
&
map
))
goto
exit
;
return_value
=
_codecs_charmap_build_impl
(
module
,
map
);
exit:
return
return_value
;
}
#if defined(HAVE_MBCS)
PyDoc_STRVAR
(
_codecs_mbcs_encode__doc__
,
"mbcs_encode($module, str, errors=None, /)
\n
"
"--
\n
"
"
\n
"
);
#define _CODECS_MBCS_ENCODE_METHODDEF \
{"mbcs_encode", (PyCFunction)_codecs_mbcs_encode, METH_VARARGS, _codecs_mbcs_encode__doc__},
static
PyObject
*
_codecs_mbcs_encode_impl
(
PyModuleDef
*
module
,
PyObject
*
str
,
const
char
*
errors
);
static
PyObject
*
_codecs_mbcs_encode
(
PyModuleDef
*
module
,
PyObject
*
args
)
{
PyObject
*
return_value
=
NULL
;
PyObject
*
str
;
const
char
*
errors
=
NULL
;
if
(
!
PyArg_ParseTuple
(
args
,
"O|z:mbcs_encode"
,
&
str
,
&
errors
))
goto
exit
;
return_value
=
_codecs_mbcs_encode_impl
(
module
,
str
,
errors
);
exit:
return
return_value
;
}
#endif
/* defined(HAVE_MBCS) */
#if defined(HAVE_MBCS)
PyDoc_STRVAR
(
_codecs_code_page_encode__doc__
,
"code_page_encode($module, code_page, str, errors=None, /)
\n
"
"--
\n
"
"
\n
"
);
#define _CODECS_CODE_PAGE_ENCODE_METHODDEF \
{"code_page_encode", (PyCFunction)_codecs_code_page_encode, METH_VARARGS, _codecs_code_page_encode__doc__},
static
PyObject
*
_codecs_code_page_encode_impl
(
PyModuleDef
*
module
,
int
code_page
,
PyObject
*
str
,
const
char
*
errors
);
static
PyObject
*
_codecs_code_page_encode
(
PyModuleDef
*
module
,
PyObject
*
args
)
{
PyObject
*
return_value
=
NULL
;
int
code_page
;
PyObject
*
str
;
const
char
*
errors
=
NULL
;
if
(
!
PyArg_ParseTuple
(
args
,
"iO|z:code_page_encode"
,
&
code_page
,
&
str
,
&
errors
))
goto
exit
;
return_value
=
_codecs_code_page_encode_impl
(
module
,
code_page
,
str
,
errors
);
exit:
return
return_value
;
}
#endif
/* defined(HAVE_MBCS) */
PyDoc_STRVAR
(
_codecs_register_error__doc__
,
"register_error($module, errors, handler, /)
\n
"
"--
\n
"
"
\n
"
"Register the specified error handler under the name errors.
\n
"
"
\n
"
"handler must be a callable object, that will be called with an exception
\n
"
"instance containing information about the location of the encoding/decoding
\n
"
"error and must return a (replacement, new position) tuple."
);
#define _CODECS_REGISTER_ERROR_METHODDEF \
{"register_error", (PyCFunction)_codecs_register_error, METH_VARARGS, _codecs_register_error__doc__},
static
PyObject
*
_codecs_register_error_impl
(
PyModuleDef
*
module
,
const
char
*
errors
,
PyObject
*
handler
);
static
PyObject
*
_codecs_register_error
(
PyModuleDef
*
module
,
PyObject
*
args
)
{
PyObject
*
return_value
=
NULL
;
const
char
*
errors
;
PyObject
*
handler
;
if
(
!
PyArg_ParseTuple
(
args
,
"sO:register_error"
,
&
errors
,
&
handler
))
goto
exit
;
return_value
=
_codecs_register_error_impl
(
module
,
errors
,
handler
);
exit:
return
return_value
;
}
PyDoc_STRVAR
(
_codecs_lookup_error__doc__
,
"lookup_error($module, name, /)
\n
"
"--
\n
"
"
\n
"
"lookup_error(errors) -> handler
\n
"
"
\n
"
"Return the error handler for the specified error handling name or raise a
\n
"
"LookupError, if no handler exists under this name."
);
#define _CODECS_LOOKUP_ERROR_METHODDEF \
{"lookup_error", (PyCFunction)_codecs_lookup_error, METH_O, _codecs_lookup_error__doc__},
static
PyObject
*
_codecs_lookup_error_impl
(
PyModuleDef
*
module
,
const
char
*
name
);
static
PyObject
*
_codecs_lookup_error
(
PyModuleDef
*
module
,
PyObject
*
arg
)
{
PyObject
*
return_value
=
NULL
;
const
char
*
name
;
if
(
!
PyArg_Parse
(
arg
,
"s:lookup_error"
,
&
name
))
goto
exit
;
return_value
=
_codecs_lookup_error_impl
(
module
,
name
);
exit:
return
return_value
;
}
#ifndef _CODECS_MBCS_DECODE_METHODDEF
#define _CODECS_MBCS_DECODE_METHODDEF
#endif
/* !defined(_CODECS_MBCS_DECODE_METHODDEF) */
#ifndef _CODECS_CODE_PAGE_DECODE_METHODDEF
#define _CODECS_CODE_PAGE_DECODE_METHODDEF
#endif
/* !defined(_CODECS_CODE_PAGE_DECODE_METHODDEF) */
#ifndef _CODECS_MBCS_ENCODE_METHODDEF
#define _CODECS_MBCS_ENCODE_METHODDEF
#endif
/* !defined(_CODECS_MBCS_ENCODE_METHODDEF) */
#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]*/
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment