mirror of
https://github.com/python/cpython.git
synced 2025-08-03 00:23:06 +00:00
Issue #22413: Merge StringIO doc from 3.5
This commit is contained in:
commit
a6d5038226
3 changed files with 20 additions and 9 deletions
|
@ -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);
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue