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

Side by Side Diff: Modules/_io/fileio.c

Issue 10639: reindent.py converts newlines to platform default
Patch Set: Created 8 years, 8 months ago
Left:
Right:
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 unified diff | Download patch
« no previous file with comments | « Modules/faulthandler.c ('k') | Modules/_io/textio.c » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* Author: Daniel Stutzbach */ 1 /* Author: Daniel Stutzbach */
2 2
3 #define PY_SSIZE_T_CLEAN 3 #define PY_SSIZE_T_CLEAN
4 #include "Python.h" 4 #include "Python.h"
5 #include "structmember.h" 5 #include "structmember.h"
6 #ifdef HAVE_SYS_TYPES_H 6 #ifdef HAVE_SYS_TYPES_H
7 #include <sys/types.h> 7 #include <sys/types.h>
8 #endif 8 #endif
9 #ifdef HAVE_SYS_STAT_H 9 #ifdef HAVE_SYS_STAT_H
10 #include <sys/stat.h> 10 #include <sys/stat.h>
(...skipping 669 matching lines...) Expand 10 before | Expand all | Expand 10 after
680 if (!self->readable) 680 if (!self->readable)
681 return err_mode("reading"); 681 return err_mode("reading");
682 682
683 if (!PyArg_ParseTuple(args, "|O&", &_PyIO_ConvertSsize_t, &size)) 683 if (!PyArg_ParseTuple(args, "|O&", &_PyIO_ConvertSsize_t, &size))
684 return NULL; 684 return NULL;
685 685
686 if (size < 0) { 686 if (size < 0) {
687 return fileio_readall(self); 687 return fileio_readall(self);
688 } 688 }
689 689
690 #if defined(MS_WIN64) || defined(MS_WINDOWS)
691 if (size > INT_MAX)
692 size = INT_MAX;
693 #endif
694 bytes = PyBytes_FromStringAndSize(NULL, size); 690 bytes = PyBytes_FromStringAndSize(NULL, size);
695 if (bytes == NULL) 691 if (bytes == NULL)
696 return NULL; 692 return NULL;
697 ptr = PyBytes_AS_STRING(bytes); 693 ptr = PyBytes_AS_STRING(bytes);
698 694
699 if (_PyVerify_fd(self->fd)) { 695 if (_PyVerify_fd(self->fd)) {
700 Py_BEGIN_ALLOW_THREADS 696 Py_BEGIN_ALLOW_THREADS
701 errno = 0; 697 errno = 0;
702 #if defined(MS_WIN64) || defined(MS_WINDOWS)
703 n = read(self->fd, ptr, (int)size);
704 #else
705 n = read(self->fd, ptr, size); 698 n = read(self->fd, ptr, size);
706 #endif
707 Py_END_ALLOW_THREADS 699 Py_END_ALLOW_THREADS
708 } else 700 } else
709 n = -1; 701 n = -1;
710 702
711 if (n < 0) { 703 if (n < 0) {
712 Py_DECREF(bytes); 704 Py_DECREF(bytes);
713 if (errno == EAGAIN) 705 if (errno == EAGAIN)
714 Py_RETURN_NONE; 706 Py_RETURN_NONE;
715 PyErr_SetFromErrno(PyExc_IOError); 707 PyErr_SetFromErrno(PyExc_IOError);
716 return NULL; 708 return NULL;
(...skipping 463 matching lines...) Expand 10 before | Expand all | Expand 10 after
1180 0, /* tp_base */ 1172 0, /* tp_base */
1181 0, /* tp_dict */ 1173 0, /* tp_dict */
1182 0, /* tp_descr_get */ 1174 0, /* tp_descr_get */
1183 0, /* tp_descr_set */ 1175 0, /* tp_descr_set */
1184 offsetof(fileio, dict), /* tp_dictoffset */ 1176 offsetof(fileio, dict), /* tp_dictoffset */
1185 fileio_init, /* tp_init */ 1177 fileio_init, /* tp_init */
1186 PyType_GenericAlloc, /* tp_alloc */ 1178 PyType_GenericAlloc, /* tp_alloc */
1187 fileio_new, /* tp_new */ 1179 fileio_new, /* tp_new */
1188 PyObject_GC_Del, /* tp_free */ 1180 PyObject_GC_Del, /* tp_free */
1189 }; 1181 };
OLDNEW
« no previous file with comments | « Modules/faulthandler.c ('k') | Modules/_io/textio.c » ('j') | no next file with comments »

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