bpo-24037: Add Argument Clinic converter `bool(accept={int})`. (#485)
This commit is contained in:
parent
0767ad40bf
commit
202fda55c2
|
@ -910,6 +910,10 @@ Build
|
|||
Tools/Demos
|
||||
-----------
|
||||
|
||||
- bpo-24037: Argument Clinic now uses the converter `bool(accept={int})` rather
|
||||
than `int` for semantical booleans. This avoids repeating the default
|
||||
value for Python and C and will help in converting to `bool` in future.
|
||||
|
||||
- Issue #29367: python-gdb.py now supports also ``method-wrapper``
|
||||
(``wrapperobject``) objects.
|
||||
|
||||
|
|
|
@ -286,14 +286,14 @@ _codecs_unicode_internal_decode_impl(PyObject *module, PyObject *obj,
|
|||
_codecs.utf_7_decode
|
||||
data: Py_buffer
|
||||
errors: str(accept={str, NoneType}) = NULL
|
||||
final: int(c_default="0") = False
|
||||
final: bool(accept={int}) = False
|
||||
/
|
||||
[clinic start generated code]*/
|
||||
|
||||
static PyObject *
|
||||
_codecs_utf_7_decode_impl(PyObject *module, Py_buffer *data,
|
||||
const char *errors, int final)
|
||||
/*[clinic end generated code: output=0cd3a944a32a4089 input=bc4d6247ecdb01e6]*/
|
||||
/*[clinic end generated code: output=0cd3a944a32a4089 input=2d94a5a1f170c8ae]*/
|
||||
{
|
||||
Py_ssize_t consumed = data->len;
|
||||
PyObject *decoded = PyUnicode_DecodeUTF7Stateful(data->buf, data->len,
|
||||
|
@ -306,14 +306,14 @@ _codecs_utf_7_decode_impl(PyObject *module, Py_buffer *data,
|
|||
_codecs.utf_8_decode
|
||||
data: Py_buffer
|
||||
errors: str(accept={str, NoneType}) = NULL
|
||||
final: int(c_default="0") = False
|
||||
final: bool(accept={int}) = False
|
||||
/
|
||||
[clinic start generated code]*/
|
||||
|
||||
static PyObject *
|
||||
_codecs_utf_8_decode_impl(PyObject *module, Py_buffer *data,
|
||||
const char *errors, int final)
|
||||
/*[clinic end generated code: output=10f74dec8d9bb8bf input=39161d71e7422ee2]*/
|
||||
/*[clinic end generated code: output=10f74dec8d9bb8bf input=1ea6c21492e8bcbe]*/
|
||||
{
|
||||
Py_ssize_t consumed = data->len;
|
||||
PyObject *decoded = PyUnicode_DecodeUTF8Stateful(data->buf, data->len,
|
||||
|
@ -326,14 +326,14 @@ _codecs_utf_8_decode_impl(PyObject *module, Py_buffer *data,
|
|||
_codecs.utf_16_decode
|
||||
data: Py_buffer
|
||||
errors: str(accept={str, NoneType}) = NULL
|
||||
final: int(c_default="0") = False
|
||||
final: bool(accept={int}) = False
|
||||
/
|
||||
[clinic start generated code]*/
|
||||
|
||||
static PyObject *
|
||||
_codecs_utf_16_decode_impl(PyObject *module, Py_buffer *data,
|
||||
const char *errors, int final)
|
||||
/*[clinic end generated code: output=783b442abcbcc2d0 input=f3cf01d1461007ce]*/
|
||||
/*[clinic end generated code: output=783b442abcbcc2d0 input=2ba128c28ea0bb40]*/
|
||||
{
|
||||
int byteorder = 0;
|
||||
/* This is overwritten unless final is true. */
|
||||
|
@ -348,14 +348,14 @@ _codecs_utf_16_decode_impl(PyObject *module, Py_buffer *data,
|
|||
_codecs.utf_16_le_decode
|
||||
data: Py_buffer
|
||||
errors: str(accept={str, NoneType}) = NULL
|
||||
final: int(c_default="0") = False
|
||||
final: bool(accept={int}) = False
|
||||
/
|
||||
[clinic start generated code]*/
|
||||
|
||||
static PyObject *
|
||||
_codecs_utf_16_le_decode_impl(PyObject *module, Py_buffer *data,
|
||||
const char *errors, int final)
|
||||
/*[clinic end generated code: output=899b9e6364379dcd input=a77e3bf97335d94e]*/
|
||||
/*[clinic end generated code: output=899b9e6364379dcd input=43aeb8b0461cace5]*/
|
||||
{
|
||||
int byteorder = -1;
|
||||
/* This is overwritten unless final is true. */
|
||||
|
@ -370,14 +370,14 @@ _codecs_utf_16_le_decode_impl(PyObject *module, Py_buffer *data,
|
|||
_codecs.utf_16_be_decode
|
||||
data: Py_buffer
|
||||
errors: str(accept={str, NoneType}) = NULL
|
||||
final: int(c_default="0") = False
|
||||
final: bool(accept={int}) = False
|
||||
/
|
||||
[clinic start generated code]*/
|
||||
|
||||
static PyObject *
|
||||
_codecs_utf_16_be_decode_impl(PyObject *module, Py_buffer *data,
|
||||
const char *errors, int final)
|
||||
/*[clinic end generated code: output=49f6465ea07669c8 input=606f69fae91b5563]*/
|
||||
/*[clinic end generated code: output=49f6465ea07669c8 input=339e554c804f34b2]*/
|
||||
{
|
||||
int byteorder = 1;
|
||||
/* This is overwritten unless final is true. */
|
||||
|
@ -400,14 +400,14 @@ _codecs.utf_16_ex_decode
|
|||
data: Py_buffer
|
||||
errors: str(accept={str, NoneType}) = NULL
|
||||
byteorder: int = 0
|
||||
final: int(c_default="0") = False
|
||||
final: bool(accept={int}) = False
|
||||
/
|
||||
[clinic start generated code]*/
|
||||
|
||||
static PyObject *
|
||||
_codecs_utf_16_ex_decode_impl(PyObject *module, Py_buffer *data,
|
||||
const char *errors, int byteorder, int final)
|
||||
/*[clinic end generated code: output=0f385f251ecc1988 input=f6e7f697658c013e]*/
|
||||
/*[clinic end generated code: output=0f385f251ecc1988 input=3201aeddb9636889]*/
|
||||
{
|
||||
/* This is overwritten unless final is true. */
|
||||
Py_ssize_t consumed = data->len;
|
||||
|
@ -424,14 +424,14 @@ _codecs_utf_16_ex_decode_impl(PyObject *module, Py_buffer *data,
|
|||
_codecs.utf_32_decode
|
||||
data: Py_buffer
|
||||
errors: str(accept={str, NoneType}) = NULL
|
||||
final: int(c_default="0") = False
|
||||
final: bool(accept={int}) = False
|
||||
/
|
||||
[clinic start generated code]*/
|
||||
|
||||
static PyObject *
|
||||
_codecs_utf_32_decode_impl(PyObject *module, Py_buffer *data,
|
||||
const char *errors, int final)
|
||||
/*[clinic end generated code: output=2fc961807f7b145f input=86d4f41c6c2e763d]*/
|
||||
/*[clinic end generated code: output=2fc961807f7b145f input=155a5c673a4e2514]*/
|
||||
{
|
||||
int byteorder = 0;
|
||||
/* This is overwritten unless final is true. */
|
||||
|
@ -446,14 +446,14 @@ _codecs_utf_32_decode_impl(PyObject *module, Py_buffer *data,
|
|||
_codecs.utf_32_le_decode
|
||||
data: Py_buffer
|
||||
errors: str(accept={str, NoneType}) = NULL
|
||||
final: int(c_default="0") = False
|
||||
final: bool(accept={int}) = False
|
||||
/
|
||||
[clinic start generated code]*/
|
||||
|
||||
static PyObject *
|
||||
_codecs_utf_32_le_decode_impl(PyObject *module, Py_buffer *data,
|
||||
const char *errors, int final)
|
||||
/*[clinic end generated code: output=ec8f46b67a94f3e6 input=d18b650772d188ba]*/
|
||||
/*[clinic end generated code: output=ec8f46b67a94f3e6 input=7baf061069e92d3b]*/
|
||||
{
|
||||
int byteorder = -1;
|
||||
/* This is overwritten unless final is true. */
|
||||
|
@ -468,14 +468,14 @@ _codecs_utf_32_le_decode_impl(PyObject *module, Py_buffer *data,
|
|||
_codecs.utf_32_be_decode
|
||||
data: Py_buffer
|
||||
errors: str(accept={str, NoneType}) = NULL
|
||||
final: int(c_default="0") = False
|
||||
final: bool(accept={int}) = False
|
||||
/
|
||||
[clinic start generated code]*/
|
||||
|
||||
static PyObject *
|
||||
_codecs_utf_32_be_decode_impl(PyObject *module, Py_buffer *data,
|
||||
const char *errors, int final)
|
||||
/*[clinic end generated code: output=ff82bae862c92c4e input=19c271b5d34926d8]*/
|
||||
/*[clinic end generated code: output=ff82bae862c92c4e input=b182026300dae595]*/
|
||||
{
|
||||
int byteorder = 1;
|
||||
/* This is overwritten unless final is true. */
|
||||
|
@ -498,14 +498,14 @@ _codecs.utf_32_ex_decode
|
|||
data: Py_buffer
|
||||
errors: str(accept={str, NoneType}) = NULL
|
||||
byteorder: int = 0
|
||||
final: int(c_default="0") = False
|
||||
final: bool(accept={int}) = False
|
||||
/
|
||||
[clinic start generated code]*/
|
||||
|
||||
static PyObject *
|
||||
_codecs_utf_32_ex_decode_impl(PyObject *module, Py_buffer *data,
|
||||
const char *errors, int byteorder, int final)
|
||||
/*[clinic end generated code: output=6bfb177dceaf4848 input=4af3e6ccfe34a076]*/
|
||||
/*[clinic end generated code: output=6bfb177dceaf4848 input=7b9c2cb819fb237a]*/
|
||||
{
|
||||
Py_ssize_t consumed = data->len;
|
||||
PyObject *decoded = PyUnicode_DecodeUTF32Stateful(data->buf, data->len,
|
||||
|
@ -610,14 +610,14 @@ _codecs_charmap_decode_impl(PyObject *module, Py_buffer *data,
|
|||
_codecs.mbcs_decode
|
||||
data: Py_buffer
|
||||
errors: str(accept={str, NoneType}) = NULL
|
||||
final: int(c_default="0") = False
|
||||
final: bool(accept={int}) = False
|
||||
/
|
||||
[clinic start generated code]*/
|
||||
|
||||
static PyObject *
|
||||
_codecs_mbcs_decode_impl(PyObject *module, Py_buffer *data,
|
||||
const char *errors, int final)
|
||||
/*[clinic end generated code: output=39b65b8598938c4b input=d492c1ca64f4fa8a]*/
|
||||
/*[clinic end generated code: output=39b65b8598938c4b input=b5f2fe568f311297]*/
|
||||
{
|
||||
Py_ssize_t consumed = data->len;
|
||||
PyObject *decoded = PyUnicode_DecodeMBCSStateful(data->buf, data->len,
|
||||
|
@ -629,14 +629,14 @@ _codecs_mbcs_decode_impl(PyObject *module, Py_buffer *data,
|
|||
_codecs.oem_decode
|
||||
data: Py_buffer
|
||||
errors: str(accept={str, NoneType}) = NULL
|
||||
final: int(c_default="0") = False
|
||||
final: bool(accept={int}) = False
|
||||
/
|
||||
[clinic start generated code]*/
|
||||
|
||||
static PyObject *
|
||||
_codecs_oem_decode_impl(PyObject *module, Py_buffer *data,
|
||||
const char *errors, int final)
|
||||
/*[clinic end generated code: output=da1617612f3fcad8 input=95b8a92c446b03cd]*/
|
||||
/*[clinic end generated code: output=da1617612f3fcad8 input=278709bcfd374a9c]*/
|
||||
{
|
||||
Py_ssize_t consumed = data->len;
|
||||
PyObject *decoded = PyUnicode_DecodeCodePageStateful(CP_OEMCP,
|
||||
|
@ -649,14 +649,14 @@ _codecs.code_page_decode
|
|||
codepage: int
|
||||
data: Py_buffer
|
||||
errors: str(accept={str, NoneType}) = NULL
|
||||
final: int(c_default="0") = False
|
||||
final: bool(accept={int}) = False
|
||||
/
|
||||
[clinic start generated code]*/
|
||||
|
||||
static PyObject *
|
||||
_codecs_code_page_decode_impl(PyObject *module, int codepage,
|
||||
Py_buffer *data, const char *errors, int final)
|
||||
/*[clinic end generated code: output=53008ea967da3fff input=4f3152a304e21d51]*/
|
||||
/*[clinic end generated code: output=53008ea967da3fff input=51f6169021c68dd5]*/
|
||||
{
|
||||
Py_ssize_t consumed = data->len;
|
||||
PyObject *decoded = PyUnicode_DecodeCodePageStateful(codepage,
|
||||
|
|
|
@ -105,7 +105,7 @@ _io.open
|
|||
encoding: str(accept={str, NoneType}) = NULL
|
||||
errors: str(accept={str, NoneType}) = NULL
|
||||
newline: str(accept={str, NoneType}) = NULL
|
||||
closefd: int(c_default="1") = True
|
||||
closefd: bool(accept={int}) = True
|
||||
opener: object = None
|
||||
|
||||
Open file and return a stream. Raise IOError upon failure.
|
||||
|
@ -232,7 +232,7 @@ static PyObject *
|
|||
_io_open_impl(PyObject *module, PyObject *file, const char *mode,
|
||||
int buffering, const char *encoding, const char *errors,
|
||||
const char *newline, int closefd, PyObject *opener)
|
||||
/*[clinic end generated code: output=aefafc4ce2b46dc0 input=f4e1ca75223987bc]*/
|
||||
/*[clinic end generated code: output=aefafc4ce2b46dc0 input=7f81b2a1d3b02344]*/
|
||||
{
|
||||
unsigned i;
|
||||
|
||||
|
|
|
@ -207,7 +207,7 @@ extern int _Py_open_cloexec_works;
|
|||
_io.FileIO.__init__
|
||||
file as nameobj: object
|
||||
mode: str = "r"
|
||||
closefd: int(c_default="1") = True
|
||||
closefd: bool(accept={int}) = True
|
||||
opener: object = None
|
||||
|
||||
Open a file.
|
||||
|
@ -228,7 +228,7 @@ results in functionality similar to passing None).
|
|||
static int
|
||||
_io_FileIO___init___impl(fileio *self, PyObject *nameobj, const char *mode,
|
||||
int closefd, PyObject *opener)
|
||||
/*[clinic end generated code: output=23413f68e6484bbd input=193164e293d6c097]*/
|
||||
/*[clinic end generated code: output=23413f68e6484bbd input=1596c9157a042a39]*/
|
||||
{
|
||||
#ifdef MS_WINDOWS
|
||||
Py_UNICODE *widename = NULL;
|
||||
|
|
|
@ -511,13 +511,13 @@ _PyIncrementalNewlineDecoder_decode(PyObject *myself,
|
|||
/*[clinic input]
|
||||
_io.IncrementalNewlineDecoder.decode
|
||||
input: object
|
||||
final: int(c_default="0") = False
|
||||
final: bool(accept={int}) = False
|
||||
[clinic start generated code]*/
|
||||
|
||||
static PyObject *
|
||||
_io_IncrementalNewlineDecoder_decode_impl(nldecoder_object *self,
|
||||
PyObject *input, int final)
|
||||
/*[clinic end generated code: output=0d486755bb37a66e input=d65677385bfd6827]*/
|
||||
/*[clinic end generated code: output=0d486755bb37a66e input=a4ea97f26372d866]*/
|
||||
{
|
||||
return _PyIncrementalNewlineDecoder_decode((PyObject *) self, input, final);
|
||||
}
|
||||
|
@ -792,8 +792,8 @@ _io.TextIOWrapper.__init__
|
|||
encoding: str(accept={str, NoneType}) = NULL
|
||||
errors: str(accept={str, NoneType}) = NULL
|
||||
newline: str(accept={str, NoneType}) = NULL
|
||||
line_buffering: int(c_default="0") = False
|
||||
write_through: int(c_default="0") = False
|
||||
line_buffering: bool(accept={int}) = False
|
||||
write_through: bool(accept={int}) = False
|
||||
|
||||
Character and line based layer over a BufferedIOBase object, buffer.
|
||||
|
||||
|
@ -830,7 +830,7 @@ _io_TextIOWrapper___init___impl(textio *self, PyObject *buffer,
|
|||
const char *encoding, const char *errors,
|
||||
const char *newline, int line_buffering,
|
||||
int write_through)
|
||||
/*[clinic end generated code: output=56a83402ce2a8381 input=3126cb3101a2c99b]*/
|
||||
/*[clinic end generated code: output=56a83402ce2a8381 input=598d10cc5f2ed7dd]*/
|
||||
{
|
||||
PyObject *raw, *codec_info = NULL;
|
||||
_PyIO_State *state = NULL;
|
||||
|
|
|
@ -252,7 +252,7 @@ winconsoleio_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
|
|||
_io._WindowsConsoleIO.__init__
|
||||
file as nameobj: object
|
||||
mode: str = "r"
|
||||
closefd: int(c_default="1") = True
|
||||
closefd: bool(accept={int}) = True
|
||||
opener: object = None
|
||||
|
||||
Open a console buffer by file descriptor.
|
||||
|
@ -266,7 +266,7 @@ static int
|
|||
_io__WindowsConsoleIO___init___impl(winconsoleio *self, PyObject *nameobj,
|
||||
const char *mode, int closefd,
|
||||
PyObject *opener)
|
||||
/*[clinic end generated code: output=3fd9cbcdd8d95429 input=61be39633a86f5d7]*/
|
||||
/*[clinic end generated code: output=3fd9cbcdd8d95429 input=06ae4b863c63244b]*/
|
||||
{
|
||||
const char *s;
|
||||
wchar_t *name = NULL;
|
||||
|
|
|
@ -3199,11 +3199,11 @@ _tkinter.create
|
|||
screenName: str(accept={str, NoneType}) = NULL
|
||||
baseName: str = NULL
|
||||
className: str = "Tk"
|
||||
interactive: int(c_default="0") = False
|
||||
wantobjects: int(c_default="0") = False
|
||||
wantTk: int(c_default="1") = True
|
||||
interactive: bool(accept={int}) = False
|
||||
wantobjects: bool(accept={int}) = False
|
||||
wantTk: bool(accept={int}) = True
|
||||
if false, then Tk_Init() doesn't get called
|
||||
sync: int(c_default="0") = False
|
||||
sync: bool(accept={int}) = False
|
||||
if true, then pass -sync to wish
|
||||
use: str(accept={str, NoneType}) = NULL
|
||||
if not None, then pass -use to wish
|
||||
|
@ -3216,7 +3216,7 @@ _tkinter_create_impl(PyObject *module, const char *screenName,
|
|||
const char *baseName, const char *className,
|
||||
int interactive, int wantobjects, int wantTk, int sync,
|
||||
const char *use)
|
||||
/*[clinic end generated code: output=e3315607648e6bb4 input=0d522aad1cb0ca0e]*/
|
||||
/*[clinic end generated code: output=e3315607648e6bb4 input=431907c134c80085]*/
|
||||
{
|
||||
/* XXX baseName is not used anymore;
|
||||
* try getting rid of it. */
|
||||
|
|
|
@ -387,13 +387,13 @@ _winapi_CloseHandle_impl(PyObject *module, HANDLE handle)
|
|||
_winapi.ConnectNamedPipe
|
||||
|
||||
handle: HANDLE
|
||||
overlapped as use_overlapped: int(c_default='0') = False
|
||||
overlapped as use_overlapped: bool(accept={int}) = False
|
||||
[clinic start generated code]*/
|
||||
|
||||
static PyObject *
|
||||
_winapi_ConnectNamedPipe_impl(PyObject *module, HANDLE handle,
|
||||
int use_overlapped)
|
||||
/*[clinic end generated code: output=335a0e7086800671 input=edc83da007ebf3be]*/
|
||||
/*[clinic end generated code: output=335a0e7086800671 input=34f937c1c86e5e68]*/
|
||||
{
|
||||
BOOL success;
|
||||
OverlappedObject *overlapped = NULL;
|
||||
|
@ -1161,13 +1161,13 @@ _winapi.ReadFile
|
|||
|
||||
handle: HANDLE
|
||||
size: int
|
||||
overlapped as use_overlapped: int(c_default='0') = False
|
||||
overlapped as use_overlapped: bool(accept={int}) = False
|
||||
[clinic start generated code]*/
|
||||
|
||||
static PyObject *
|
||||
_winapi_ReadFile_impl(PyObject *module, HANDLE handle, int size,
|
||||
int use_overlapped)
|
||||
/*[clinic end generated code: output=492029ca98161d84 input=8dd810194e86ac7d]*/
|
||||
/*[clinic end generated code: output=492029ca98161d84 input=3f0fde92f74de59a]*/
|
||||
{
|
||||
DWORD nread;
|
||||
PyObject *buf;
|
||||
|
@ -1413,13 +1413,13 @@ _winapi.WriteFile
|
|||
|
||||
handle: HANDLE
|
||||
buffer: object
|
||||
overlapped as use_overlapped: int(c_default='0') = False
|
||||
overlapped as use_overlapped: bool(accept={int}) = False
|
||||
[clinic start generated code]*/
|
||||
|
||||
static PyObject *
|
||||
_winapi_WriteFile_impl(PyObject *module, HANDLE handle, PyObject *buffer,
|
||||
int use_overlapped)
|
||||
/*[clinic end generated code: output=2ca80f6bf3fa92e3 input=51846a5af52053fd]*/
|
||||
/*[clinic end generated code: output=2ca80f6bf3fa92e3 input=11eae2a03aa32731]*/
|
||||
{
|
||||
Py_buffer _buf, *buf;
|
||||
DWORD len, written;
|
||||
|
|
|
@ -516,14 +516,14 @@ binascii.b2a_base64
|
|||
|
||||
data: Py_buffer
|
||||
*
|
||||
newline: int(c_default="1") = True
|
||||
newline: bool(accept={int}) = True
|
||||
|
||||
Base64-code line of data.
|
||||
[clinic start generated code]*/
|
||||
|
||||
static PyObject *
|
||||
binascii_b2a_base64_impl(PyObject *module, Py_buffer *data, int newline)
|
||||
/*[clinic end generated code: output=4ad62c8e8485d3b3 input=7b2ea6fa38d8924c]*/
|
||||
/*[clinic end generated code: output=4ad62c8e8485d3b3 input=144fd7267a34d51c]*/
|
||||
{
|
||||
unsigned char *ascii_data;
|
||||
const unsigned char *bin_data;
|
||||
|
@ -1229,14 +1229,14 @@ static const int table_hex[128] = {
|
|||
binascii.a2b_qp
|
||||
|
||||
data: ascii_buffer
|
||||
header: int(c_default="0") = False
|
||||
header: bool(accept={int}) = False
|
||||
|
||||
Decode a string of qp-encoded data.
|
||||
[clinic start generated code]*/
|
||||
|
||||
static PyObject *
|
||||
binascii_a2b_qp_impl(PyObject *module, Py_buffer *data, int header)
|
||||
/*[clinic end generated code: output=e99f7846cfb9bc53 input=5187a0d3d8e54f3b]*/
|
||||
/*[clinic end generated code: output=e99f7846cfb9bc53 input=bf6766fea76cce8f]*/
|
||||
{
|
||||
Py_ssize_t in, out;
|
||||
char ch;
|
||||
|
@ -1331,9 +1331,9 @@ to_hex (unsigned char ch, unsigned char *s)
|
|||
binascii.b2a_qp
|
||||
|
||||
data: Py_buffer
|
||||
quotetabs: int(c_default="0") = False
|
||||
istext: int(c_default="1") = True
|
||||
header: int(c_default="0") = False
|
||||
quotetabs: bool(accept={int}) = False
|
||||
istext: bool(accept={int}) = True
|
||||
header: bool(accept={int}) = False
|
||||
|
||||
Encode a string using quoted-printable encoding.
|
||||
|
||||
|
@ -1345,7 +1345,7 @@ are both encoded. When quotetabs is set, space and tabs are encoded.
|
|||
static PyObject *
|
||||
binascii_b2a_qp_impl(PyObject *module, Py_buffer *data, int quotetabs,
|
||||
int istext, int header)
|
||||
/*[clinic end generated code: output=e9884472ebb1a94c input=7f2a9aaa008e92b2]*/
|
||||
/*[clinic end generated code: output=e9884472ebb1a94c input=21fb7eea4a184ba6]*/
|
||||
{
|
||||
Py_ssize_t in, out;
|
||||
const unsigned char *databuf;
|
||||
|
|
|
@ -883,14 +883,14 @@ decoder_feed_buffer(MultibyteStatefulDecoderContext *ctx,
|
|||
_multibytecodec.MultibyteIncrementalEncoder.encode
|
||||
|
||||
input: object
|
||||
final: int(c_default="0") = False
|
||||
final: bool(accept={int}) = False
|
||||
[clinic start generated code]*/
|
||||
|
||||
static PyObject *
|
||||
_multibytecodec_MultibyteIncrementalEncoder_encode_impl(MultibyteIncrementalEncoderObject *self,
|
||||
PyObject *input,
|
||||
int final)
|
||||
/*[clinic end generated code: output=123361b6c505e2c1 input=a345c688fa664f92]*/
|
||||
/*[clinic end generated code: output=123361b6c505e2c1 input=093a1ddbb2fc6721]*/
|
||||
{
|
||||
return encoder_encode_stateful(STATEFUL_ECTX(self), input, final);
|
||||
}
|
||||
|
@ -1040,14 +1040,14 @@ static PyTypeObject MultibyteIncrementalEncoder_Type = {
|
|||
_multibytecodec.MultibyteIncrementalDecoder.decode
|
||||
|
||||
input: Py_buffer
|
||||
final: int(c_default="0") = False
|
||||
final: bool(accept={int}) = False
|
||||
[clinic start generated code]*/
|
||||
|
||||
static PyObject *
|
||||
_multibytecodec_MultibyteIncrementalDecoder_decode_impl(MultibyteIncrementalDecoderObject *self,
|
||||
Py_buffer *input,
|
||||
int final)
|
||||
/*[clinic end generated code: output=b9b9090e8a9ce2ba input=576631c61906d39d]*/
|
||||
/*[clinic end generated code: output=b9b9090e8a9ce2ba input=c9132b24d503eb1d]*/
|
||||
{
|
||||
MultibyteDecodeBuffer buf;
|
||||
char *data, *wdata = NULL;
|
||||
|
|
|
@ -705,7 +705,7 @@ get_parse_result(xmlparseobject *self, int rv)
|
|||
pyexpat.xmlparser.Parse
|
||||
|
||||
data: object
|
||||
isfinal: int(c_default="0") = False
|
||||
isfinal: bool(accept={int}) = False
|
||||
/
|
||||
|
||||
Parse XML data.
|
||||
|
@ -716,7 +716,7 @@ Parse XML data.
|
|||
static PyObject *
|
||||
pyexpat_xmlparser_Parse_impl(xmlparseobject *self, PyObject *data,
|
||||
int isfinal)
|
||||
/*[clinic end generated code: output=f4db843dd1f4ed4b input=199d9e8e92ebbb4b]*/
|
||||
/*[clinic end generated code: output=f4db843dd1f4ed4b input=eb616027bfa9847f]*/
|
||||
{
|
||||
const char *s;
|
||||
Py_ssize_t slen;
|
||||
|
|
|
@ -1952,7 +1952,7 @@ bytearray_join(PyByteArrayObject *self, PyObject *iterable_of_bytes)
|
|||
/*[clinic input]
|
||||
bytearray.splitlines
|
||||
|
||||
keepends: int(c_default="0") = False
|
||||
keepends: bool(accept={int}) = False
|
||||
|
||||
Return a list of the lines in the bytearray, breaking at line boundaries.
|
||||
|
||||
|
@ -1962,7 +1962,7 @@ true.
|
|||
|
||||
static PyObject *
|
||||
bytearray_splitlines_impl(PyByteArrayObject *self, int keepends)
|
||||
/*[clinic end generated code: output=4223c94b895f6ad9 input=8ccade941e5ea0bd]*/
|
||||
/*[clinic end generated code: output=4223c94b895f6ad9 input=99a27ad959b9cf6b]*/
|
||||
{
|
||||
return stringlib_splitlines(
|
||||
(PyObject*) self, PyByteArray_AS_STRING(self),
|
||||
|
|
|
@ -2293,7 +2293,7 @@ bytes_decode_impl(PyBytesObject *self, const char *encoding,
|
|||
/*[clinic input]
|
||||
bytes.splitlines
|
||||
|
||||
keepends: int(c_default="0") = False
|
||||
keepends: bool(accept={int}) = False
|
||||
|
||||
Return a list of the lines in the bytes, breaking at line boundaries.
|
||||
|
||||
|
@ -2303,7 +2303,7 @@ true.
|
|||
|
||||
static PyObject *
|
||||
bytes_splitlines_impl(PyBytesObject *self, int keepends)
|
||||
/*[clinic end generated code: output=3484149a5d880ffb input=7f4aac67144f9944]*/
|
||||
/*[clinic end generated code: output=3484149a5d880ffb input=a8b32eb01ff5a5ed]*/
|
||||
{
|
||||
return stringlib_splitlines(
|
||||
(PyObject*) self, PyBytes_AS_STRING(self),
|
||||
|
|
|
@ -1968,14 +1968,14 @@ list.sort
|
|||
|
||||
*
|
||||
key as keyfunc: object = None
|
||||
reverse: int(c_default="0") = False
|
||||
reverse: bool(accept={int}) = False
|
||||
|
||||
Stable sort *IN PLACE*.
|
||||
[clinic start generated code]*/
|
||||
|
||||
static PyObject *
|
||||
list_sort_impl(PyListObject *self, PyObject *keyfunc, int reverse)
|
||||
/*[clinic end generated code: output=57b9f9c5e23fbe42 input=5029c13c9209d86a]*/
|
||||
/*[clinic end generated code: output=57b9f9c5e23fbe42 input=b0fcf743982c5b90]*/
|
||||
{
|
||||
MergeState ms;
|
||||
Py_ssize_t nremaining;
|
||||
|
|
|
@ -13089,7 +13089,7 @@ unicode_rsplit_impl(PyObject *self, PyObject *sep, Py_ssize_t maxsplit)
|
|||
/*[clinic input]
|
||||
str.splitlines as unicode_splitlines
|
||||
|
||||
keepends: int(c_default="0") = False
|
||||
keepends: bool(accept={int}) = False
|
||||
|
||||
Return a list of the lines in the string, breaking at line boundaries.
|
||||
|
||||
|
@ -13099,7 +13099,7 @@ true.
|
|||
|
||||
static PyObject *
|
||||
unicode_splitlines_impl(PyObject *self, int keepends)
|
||||
/*[clinic end generated code: output=f664dcdad153ec40 input=d6ff99fe43465b0f]*/
|
||||
/*[clinic end generated code: output=f664dcdad153ec40 input=b508e180459bdd8b]*/
|
||||
{
|
||||
return PyUnicode_Splitlines(self, keepends);
|
||||
}
|
||||
|
|
|
@ -661,7 +661,7 @@ compile as builtin_compile
|
|||
filename: object(converter="PyUnicode_FSDecoder")
|
||||
mode: str
|
||||
flags: int = 0
|
||||
dont_inherit: int(c_default="0") = False
|
||||
dont_inherit: bool(accept={int}) = False
|
||||
optimize: int = -1
|
||||
|
||||
Compile source into a code object that can be executed by exec() or eval().
|
||||
|
@ -682,7 +682,7 @@ static PyObject *
|
|||
builtin_compile_impl(PyObject *module, PyObject *source, PyObject *filename,
|
||||
const char *mode, int flags, int dont_inherit,
|
||||
int optimize)
|
||||
/*[clinic end generated code: output=1fa176e33452bb63 input=9d53e8cfb3c86414]*/
|
||||
/*[clinic end generated code: output=1fa176e33452bb63 input=0ff726f595eb9fcd]*/
|
||||
{
|
||||
PyObject *source_copy;
|
||||
const char *str;
|
||||
|
|
|
@ -2546,7 +2546,11 @@ class bool_converter(CConverter):
|
|||
format_unit = 'p'
|
||||
c_ignored_default = '0'
|
||||
|
||||
def converter_init(self):
|
||||
def converter_init(self, *, accept={object}):
|
||||
if accept == {int}:
|
||||
self.format_unit = 'i'
|
||||
elif accept != {object}:
|
||||
fail("bool_converter: illegal 'accept' argument " + repr(accept))
|
||||
if self.default is not unspecified:
|
||||
self.default = bool(self.default)
|
||||
self.c_default = str(int(self.default))
|
||||
|
|
Loading…
Reference in New Issue