diff options
author | Martin Panter <vadmium+py@gmail.com> | 2015-10-10 10:20:25 (GMT) |
---|---|---|
committer | Martin Panter <vadmium+py@gmail.com> | 2015-10-10 10:20:25 (GMT) |
commit | a6d5038226e596d9a3f96c6db566a3152ea3bef5 (patch) | |
tree | d7377fd16238e421972626d83391711981eedb41 /Modules | |
parent | 1431c5af94d91850b514b760313e4fbc4ba932b9 (diff) | |
parent | f26441609310c12826fe4b5bc896aafafa268763 (diff) | |
download | cpython-a6d5038226e596d9a3f96c6db566a3152ea3bef5.zip cpython-a6d5038226e596d9a3f96c6db566a3152ea3bef5.tar.gz cpython-a6d5038226e596d9a3f96c6db566a3152ea3bef5.tar.bz2 |
Issue #22413: Merge StringIO doc from 3.5
Diffstat (limited to 'Modules')
-rw-r--r-- | Modules/_io/_iomodule.h | 7 | ||||
-rw-r--r-- | Modules/_io/stringio.c | 6 |
2 files changed, 8 insertions, 5 deletions
diff --git a/Modules/_io/_iomodule.h b/Modules/_io/_iomodule.h index 9d5205e..0c6eae2 100644 --- a/Modules/_io/_iomodule.h +++ b/Modules/_io/_iomodule.h @@ -52,7 +52,12 @@ extern PyObject *_PyIncrementalNewlineDecoder_decode( which can be safely put aside until another search. NOTE: for performance reasons, `end` must point to a NUL character ('\0'). - Otherwise, the function will scan further and return garbage. */ + Otherwise, the function will scan further and return garbage. + + There are three modes, in order of priority: + * translated: Only find \n (assume newlines already translated) + * universal: Use universal newlines algorithm + * Otherwise, the line ending is specified by readnl, a str object */ extern Py_ssize_t _PyIO_find_line_ending( int translated, int universal, PyObject *readnl, int kind, char *start, char *end, Py_ssize_t *consumed); diff --git a/Modules/_io/stringio.c b/Modules/_io/stringio.c index 21c2b19..73018a5 100644 --- a/Modules/_io/stringio.c +++ b/Modules/_io/stringio.c @@ -696,10 +696,8 @@ _io_StringIO___init___impl(stringio *self, PyObject *value, char *newline = "\n"; Py_ssize_t value_len; - /* Parse the newline argument. This used to be done with the 'z' - specifier, however this allowed any object with the buffer interface to - be converted. Thus we have to parse it manually since we only want to - allow unicode objects or None. */ + /* Parse the newline argument. We only want to allow unicode objects or + None. */ if (newline_obj == Py_None) { newline = NULL; } |