diff options
author | Antoine Pitrou <pitrou@free.fr> | 2017-06-03 10:32:28 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-06-03 10:32:28 (GMT) |
commit | 3c2817b6884a5fcf792197203f3c26b157210607 (patch) | |
tree | 36f32bf5581fb14a60257630be600cc1077a260c /Modules/_io/clinic | |
parent | ae8750bca8234a9af9382b9d7e457b57f810ad64 (diff) | |
download | cpython-3c2817b6884a5fcf792197203f3c26b157210607.zip cpython-3c2817b6884a5fcf792197203f3c26b157210607.tar.gz cpython-3c2817b6884a5fcf792197203f3c26b157210607.tar.bz2 |
Fix bpo-30526: Add TextIOWrapper.reconfigure() and a TextIOWrapper.write_through attribute (#1922)
* Fix bpo-30526: Add TextIOWrapper.reconfigure()
* Apply Nick's improved wording
* Update Misc/NEWS
Diffstat (limited to 'Modules/_io/clinic')
-rw-r--r-- | Modules/_io/clinic/textio.c.h | 37 |
1 files changed, 36 insertions, 1 deletions
diff --git a/Modules/_io/clinic/textio.c.h b/Modules/_io/clinic/textio.c.h index 4eab136..abb80ea 100644 --- a/Modules/_io/clinic/textio.c.h +++ b/Modules/_io/clinic/textio.c.h @@ -176,6 +176,41 @@ exit: return return_value; } +PyDoc_STRVAR(_io_TextIOWrapper_reconfigure__doc__, +"reconfigure($self, /, *, line_buffering=None, write_through=None)\n" +"--\n" +"\n" +"Reconfigure the text stream with new parameters.\n" +"\n" +"This also does an implicit stream flush."); + +#define _IO_TEXTIOWRAPPER_RECONFIGURE_METHODDEF \ + {"reconfigure", (PyCFunction)_io_TextIOWrapper_reconfigure, METH_FASTCALL, _io_TextIOWrapper_reconfigure__doc__}, + +static PyObject * +_io_TextIOWrapper_reconfigure_impl(textio *self, + PyObject *line_buffering_obj, + PyObject *write_through_obj); + +static PyObject * +_io_TextIOWrapper_reconfigure(textio *self, PyObject **args, Py_ssize_t nargs, PyObject *kwnames) +{ + PyObject *return_value = NULL; + static const char * const _keywords[] = {"line_buffering", "write_through", NULL}; + static _PyArg_Parser _parser = {"|$OO:reconfigure", _keywords, 0}; + PyObject *line_buffering_obj = Py_None; + PyObject *write_through_obj = Py_None; + + if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser, + &line_buffering_obj, &write_through_obj)) { + goto exit; + } + return_value = _io_TextIOWrapper_reconfigure_impl(self, line_buffering_obj, write_through_obj); + +exit: + return return_value; +} + PyDoc_STRVAR(_io_TextIOWrapper_detach__doc__, "detach($self, /)\n" "--\n" @@ -480,4 +515,4 @@ _io_TextIOWrapper_close(textio *self, PyObject *Py_UNUSED(ignored)) { return _io_TextIOWrapper_close_impl(self); } -/*[clinic end generated code: output=8e5c21c88c7c70bc input=a9049054013a1b77]*/ +/*[clinic end generated code: output=7d0dc8eae4b725a1 input=a9049054013a1b77]*/ |