Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(3)

Unified Diff: Modules/_io/textio.c

Issue 10639: reindent.py converts newlines to platform default
Patch Set: Created 8 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Modules/_io/fileio.c ('k') | Modules/md5module.c » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
--- a/Modules/_io/textio.c Tue Jul 26 09:37:46 2011 +0300
+++ b/Modules/_io/textio.c Mon Jul 25 09:47:18 2011 -0400
@@ -653,12 +653,10 @@
PyObject *errors;
const char *writenl; /* utf-8 encoded, NULL stands for \n */
char line_buffering;
- char write_through;
char readuniversal;
char readtranslate;
char writetranslate;
char seekable;
- char has_read1;
char telling;
char deallocating;
/* Specialized encoding func (see below) */
@@ -815,13 +813,13 @@
textiowrapper_init(textio *self, PyObject *args, PyObject *kwds)
{
char *kwlist[] = {"buffer", "encoding", "errors",
- "newline", "line_buffering", "write_through",
+ "newline", "line_buffering",
NULL};
PyObject *buffer, *raw;
char *encoding = NULL;
char *errors = NULL;
char *newline = NULL;
- int line_buffering = 0, write_through = 0;
+ int line_buffering = 0;
_PyIO_State *state = IO_STATE;
PyObject *res;
@@ -829,9 +827,9 @@
self->ok = 0;
self->detached = 0;
- if (!PyArg_ParseTupleAndKeywords(args, kwds, "O|zzzii:fileio",
+ if (!PyArg_ParseTupleAndKeywords(args, kwds, "O|zzzi:fileio",
kwlist, &buffer, &encoding, &errors,
- &newline, &line_buffering, &write_through))
+ &newline, &line_buffering))
return -1;
if (newline && newline[0] != '\0'
@@ -937,7 +935,6 @@
self->chunk_size = 8192;
self->readuniversal = (newline == NULL || newline[0] == '\0');
self->line_buffering = line_buffering;
- self->write_through = write_through;
self->readtranslate = (newline == NULL);
if (newline) {
self->readnl = PyUnicode_FromString(newline);
@@ -1047,8 +1044,6 @@
self->seekable = self->telling = PyObject_IsTrue(res);
Py_DECREF(res);
- self->has_read1 = PyObject_HasAttrString(buffer, "read1");
-
self->encoding_start_of_stream = 0;
if (self->seekable && self->encoder) {
PyObject *cookieObj;
@@ -1292,9 +1287,7 @@
text = newtext;
}
- if (self->write_through)
- needflush = 1;
- else if (self->line_buffering &&
+ if (self->line_buffering &&
(haslf ||
findchar(PyUnicode_AS_UNICODE(text),
PyUnicode_GET_SIZE(text), '\r')))
@@ -1442,8 +1435,7 @@
if (chunk_size == NULL)
goto fail;
input_chunk = PyObject_CallMethodObjArgs(self->buffer,
- (self->has_read1 ? _PyIO_str_read1: _PyIO_str_read),
- chunk_size, NULL);
+ _PyIO_str_read1, chunk_size, NULL);
Py_DECREF(chunk_size);
if (input_chunk == NULL)
goto fail;
@@ -2626,7 +2618,7 @@
{
Py_ssize_t n;
CHECK_INITIALIZED_INT(self);
- n = PyNumber_AsSsize_t(arg, PyExc_ValueError);
+ n = PyNumber_AsSsize_t(arg, PyExc_TypeError);
if (n == -1 && PyErr_Occurred())
return -1;
if (n <= 0) {
« no previous file with comments | « Modules/_io/fileio.c ('k') | Modules/md5module.c » ('j') | no next file with comments »

RSS Feeds Recent Issues | This issue
This is Rietveld 894c83f36cb7+