From 8b2e8b6cce4960e945c7c635c350c8e44a0f9022 Mon Sep 17 00:00:00 2001 From: Serhiy Storchaka Date: Sat, 30 May 2015 11:30:39 +0300 Subject: [PATCH] Specify default values of semantic booleans in Argument Clinic generated signatures as booleans. --- Modules/cjkcodecs/clinic/multibytecodec.c.h | 6 +++--- Modules/cjkcodecs/multibytecodec.c | 8 ++++---- Modules/clinic/pyexpat.c.h | 12 ++++++------ Modules/pyexpat.c | 8 ++++---- Objects/bytearrayobject.c | 4 ++-- Objects/bytesobject.c | 4 ++-- Python/bltinmodule.c | 8 ++++---- Python/clinic/bltinmodule.c.h | 10 +++++----- 8 files changed, 30 insertions(+), 30 deletions(-) diff --git a/Modules/cjkcodecs/clinic/multibytecodec.c.h b/Modules/cjkcodecs/clinic/multibytecodec.c.h index 1985147c43b..8a47ff88a68 100644 --- a/Modules/cjkcodecs/clinic/multibytecodec.c.h +++ b/Modules/cjkcodecs/clinic/multibytecodec.c.h @@ -79,7 +79,7 @@ exit: } PyDoc_STRVAR(_multibytecodec_MultibyteIncrementalEncoder_encode__doc__, -"encode($self, /, input, final=0)\n" +"encode($self, /, input, final=False)\n" "--\n" "\n"); @@ -126,7 +126,7 @@ _multibytecodec_MultibyteIncrementalEncoder_reset(MultibyteIncrementalEncoderObj } PyDoc_STRVAR(_multibytecodec_MultibyteIncrementalDecoder_decode__doc__, -"decode($self, /, input, final=0)\n" +"decode($self, /, input, final=False)\n" "--\n" "\n"); @@ -317,4 +317,4 @@ PyDoc_STRVAR(_multibytecodec___create_codec__doc__, #define _MULTIBYTECODEC___CREATE_CODEC_METHODDEF \ {"__create_codec", (PyCFunction)_multibytecodec___create_codec, METH_O, _multibytecodec___create_codec__doc__}, -/*[clinic end generated code: output=c104f5fd548c1ac5 input=a9049054013a1b77]*/ +/*[clinic end generated code: output=eebb21e18c3043d1 input=a9049054013a1b77]*/ diff --git a/Modules/cjkcodecs/multibytecodec.c b/Modules/cjkcodecs/multibytecodec.c index c4dff412ef0..c0515141c9e 100644 --- a/Modules/cjkcodecs/multibytecodec.c +++ b/Modules/cjkcodecs/multibytecodec.c @@ -884,14 +884,14 @@ decoder_feed_buffer(MultibyteStatefulDecoderContext *ctx, _multibytecodec.MultibyteIncrementalEncoder.encode input: object - final: int = 0 + final: int(c_default="0") = False [clinic start generated code]*/ static PyObject * _multibytecodec_MultibyteIncrementalEncoder_encode_impl(MultibyteIncrementalEncoderObject *self, PyObject *input, int final) -/*[clinic end generated code: output=123361b6c505e2c1 input=456b76d73e464661]*/ +/*[clinic end generated code: output=123361b6c505e2c1 input=a345c688fa664f92]*/ { return encoder_encode_stateful(STATEFUL_ECTX(self), input, final); } @@ -1041,14 +1041,14 @@ static PyTypeObject MultibyteIncrementalEncoder_Type = { _multibytecodec.MultibyteIncrementalDecoder.decode input: Py_buffer - final: int = 0 + final: int(c_default="0") = 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=eb18c2f6e83589e1]*/ +/*[clinic end generated code: output=b9b9090e8a9ce2ba input=576631c61906d39d]*/ { MultibyteDecodeBuffer buf; char *data, *wdata = NULL; diff --git a/Modules/clinic/pyexpat.c.h b/Modules/clinic/pyexpat.c.h index 72861bec3d1..379c5db637d 100644 --- a/Modules/clinic/pyexpat.c.h +++ b/Modules/clinic/pyexpat.c.h @@ -3,7 +3,7 @@ preserve [clinic start generated code]*/ PyDoc_STRVAR(pyexpat_xmlparser_Parse__doc__, -"Parse($self, data, isFinal=0, /)\n" +"Parse($self, data, isfinal=False, /)\n" "--\n" "\n" "Parse XML data.\n" @@ -15,19 +15,19 @@ PyDoc_STRVAR(pyexpat_xmlparser_Parse__doc__, static PyObject * pyexpat_xmlparser_Parse_impl(xmlparseobject *self, PyObject *data, - int isFinal); + int isfinal); static PyObject * pyexpat_xmlparser_Parse(xmlparseobject *self, PyObject *args) { PyObject *return_value = NULL; PyObject *data; - int isFinal = 0; + int isfinal = 0; if (!PyArg_ParseTuple(args, "O|i:Parse", - &data, &isFinal)) + &data, &isfinal)) goto exit; - return_value = pyexpat_xmlparser_Parse_impl(self, data, isFinal); + return_value = pyexpat_xmlparser_Parse_impl(self, data, isfinal); exit: return return_value; @@ -281,4 +281,4 @@ exit: #ifndef PYEXPAT_XMLPARSER_USEFOREIGNDTD_METHODDEF #define PYEXPAT_XMLPARSER_USEFOREIGNDTD_METHODDEF #endif /* !defined(PYEXPAT_XMLPARSER_USEFOREIGNDTD_METHODDEF) */ -/*[clinic end generated code: output=958c0faa1b855fc7 input=a9049054013a1b77]*/ +/*[clinic end generated code: output=bf4d99c9702d8a6c input=a9049054013a1b77]*/ diff --git a/Modules/pyexpat.c b/Modules/pyexpat.c index 7a8e96a2d9a..a43887e04c3 100644 --- a/Modules/pyexpat.c +++ b/Modules/pyexpat.c @@ -707,7 +707,7 @@ get_parse_result(xmlparseobject *self, int rv) pyexpat.xmlparser.Parse data: object - isFinal: int = 0 + isfinal: int(c_default="0") = False / Parse XML data. @@ -717,8 +717,8 @@ Parse XML data. static PyObject * pyexpat_xmlparser_Parse_impl(xmlparseobject *self, PyObject *data, - int isFinal) -/*[clinic end generated code: output=37e105d55645b0f2 input=e37b81b8948ca7e0]*/ + int isfinal) +/*[clinic end generated code: output=f4db843dd1f4ed4b input=199d9e8e92ebbb4b]*/ { const char *s; Py_ssize_t slen; @@ -748,7 +748,7 @@ pyexpat_xmlparser_Parse_impl(xmlparseobject *self, PyObject *data, slen -= MAX_CHUNK_SIZE; } assert(MAX_CHUNK_SIZE < INT_MAX && slen < INT_MAX); - rc = XML_Parse(self->itself, s, (int)slen, isFinal); + rc = XML_Parse(self->itself, s, (int)slen, isfinal); done: if (view.buf != NULL) diff --git a/Objects/bytearrayobject.c b/Objects/bytearrayobject.c index b9477ca9f56..28b1f68eea2 100644 --- a/Objects/bytearrayobject.c +++ b/Objects/bytearrayobject.c @@ -2773,7 +2773,7 @@ bytearray_join(PyByteArrayObject *self, PyObject *iterable_of_bytes) /*[clinic input] bytearray.splitlines - keepends: int(py_default="False") = 0 + keepends: int(c_default="0") = False Return a list of the lines in the bytearray, breaking at line boundaries. @@ -2783,7 +2783,7 @@ true. static PyObject * bytearray_splitlines_impl(PyByteArrayObject *self, int keepends) -/*[clinic end generated code: output=4223c94b895f6ad9 input=36f0b25bc792f6c0]*/ +/*[clinic end generated code: output=4223c94b895f6ad9 input=8ccade941e5ea0bd]*/ { return stringlib_splitlines( (PyObject*) self, PyByteArray_AS_STRING(self), diff --git a/Objects/bytesobject.c b/Objects/bytesobject.c index d2b52c77b33..c576678c410 100644 --- a/Objects/bytesobject.c +++ b/Objects/bytesobject.c @@ -2942,7 +2942,7 @@ bytes_decode_impl(PyBytesObject*self, const char *encoding, /*[clinic input] bytes.splitlines - keepends: int(py_default="False") = 0 + keepends: int(c_default="0") = False Return a list of the lines in the bytes, breaking at line boundaries. @@ -2952,7 +2952,7 @@ true. static PyObject * bytes_splitlines_impl(PyBytesObject*self, int keepends) -/*[clinic end generated code: output=995c3598f7833cad input=ddb93e3351080c8c]*/ +/*[clinic end generated code: output=995c3598f7833cad input=7f4aac67144f9944]*/ { return stringlib_splitlines( (PyObject*) self, PyBytes_AS_STRING(self), diff --git a/Python/bltinmodule.c b/Python/bltinmodule.c index b05a70f1dd1..2f22209e9d6 100644 --- a/Python/bltinmodule.c +++ b/Python/bltinmodule.c @@ -637,7 +637,7 @@ compile as builtin_compile filename: object(converter="PyUnicode_FSDecoder") mode: str flags: int = 0 - dont_inherit: int = 0 + dont_inherit: int(c_default="0") = False optimize: int = -1 Compile source into a code object that can be executed by exec() or eval(). @@ -648,9 +648,9 @@ The mode must be 'exec' to compile a module, 'single' to compile a single (interactive) statement, or 'eval' to compile an expression. The flags argument, if present, controls which future statements influence the compilation of the code. -The dont_inherit argument, if non-zero, stops the compilation inheriting +The dont_inherit argument, if true, stops the compilation inheriting the effects of any future statements in effect in the code calling -compile; if absent or zero these statements do influence the compilation, +compile; if absent or false these statements do influence the compilation, in addition to any features explicitly specified. [clinic start generated code]*/ @@ -658,7 +658,7 @@ static PyObject * builtin_compile_impl(PyModuleDef *module, PyObject *source, PyObject *filename, const char *mode, int flags, int dont_inherit, int optimize) -/*[clinic end generated code: output=31881762c1bb90c4 input=7faa105f669fefcf]*/ +/*[clinic end generated code: output=31881762c1bb90c4 input=9d53e8cfb3c86414]*/ { Py_buffer view = {NULL, NULL}; const char *str; diff --git a/Python/clinic/bltinmodule.c.h b/Python/clinic/bltinmodule.c.h index bbca53432a8..7369148b23a 100644 --- a/Python/clinic/bltinmodule.c.h +++ b/Python/clinic/bltinmodule.c.h @@ -129,8 +129,8 @@ exit: } PyDoc_STRVAR(builtin_compile__doc__, -"compile($module, /, source, filename, mode, flags=0, dont_inherit=0,\n" -" optimize=-1)\n" +"compile($module, /, source, filename, mode, flags=0,\n" +" dont_inherit=False, optimize=-1)\n" "--\n" "\n" "Compile source into a code object that can be executed by exec() or eval().\n" @@ -141,9 +141,9 @@ PyDoc_STRVAR(builtin_compile__doc__, "single (interactive) statement, or \'eval\' to compile an expression.\n" "The flags argument, if present, controls which future statements influence\n" "the compilation of the code.\n" -"The dont_inherit argument, if non-zero, stops the compilation inheriting\n" +"The dont_inherit argument, if true, stops the compilation inheriting\n" "the effects of any future statements in effect in the code calling\n" -"compile; if absent or zero these statements do influence the compilation,\n" +"compile; if absent or false these statements do influence the compilation,\n" "in addition to any features explicitly specified."); #define BUILTIN_COMPILE_METHODDEF \ @@ -660,4 +660,4 @@ builtin_issubclass(PyModuleDef *module, PyObject *args) exit: return return_value; } -/*[clinic end generated code: output=9b34d1ca57effad8 input=a9049054013a1b77]*/ +/*[clinic end generated code: output=bec3399c0aee98d7 input=a9049054013a1b77]*/