Guido van Rossum
ff7e83d606
Patch by Mark Hammond to avoid certain header files on Windows/CE.
1999-08-27 20:39:37 +00:00
Guido van Rossum
ff1ccbfc21
casts for picky compilers.
1999-04-10 15:48:23 +00:00
Guido van Rossum
3c25904a98
Jim Ahlstrom patch: BIGCHUNK is too large for 16-bit int.
1999-01-14 19:00:14 +00:00
Guido van Rossum
41498435ba
Need to include <sys/types.h> for off_t.
1999-01-07 22:09:51 +00:00
Guido van Rossum
3c9fe0cce3
Changes for long file support by Steve Clift.
...
(This also redoes my previous patch, but better.)
1999-01-06 18:51:17 +00:00
Guido van Rossum
88303194a5
Fix two places (seek and truncate) where a cascade of PyArg_Parse
...
calls was used instead of a single PyArg_ParseTuple call with an
optional argument.
1999-01-04 17:22:18 +00:00
Guido van Rossum
cada2938f7
As noted by Per Cederqvist, new_buffersize() sometimes returns the
...
buffer increment, and sometimes the new buffer size. Make it do what
its name says, and fix the one place where this matters to the caller.
Also add a comment explaining why we call lseek() and then ftell().
1998-12-11 20:44:56 +00:00
Barry Warsaw
52ddc0e756
PyFile_FromString(): If an exception occurs, pass in the filename that
...
was used so it's reflected in the IOError. Call
PyErr_SetFromErrnoWithFilename().
1998-07-23 16:07:02 +00:00
Guido van Rossum
91aaa92c88
Ugly band-aid to work around a bug in Linux ftell().
1998-05-05 22:21:35 +00:00
Guido van Rossum
f2044e1a71
Enable ftruncate() on the Mac.
...
(Jack)
1998-04-28 16:05:59 +00:00
Guido van Rossum
d30dc0a55e
Clear the error condition set by ftell().
1998-04-27 19:01:08 +00:00
Guido van Rossum
1109fbca76
Make new gcc -Wall happy
1998-04-10 22:16:39 +00:00
Guido van Rossum
240c35aac0
Subtle fix in the read() code which could cause a read broken up in
...
several pieces to fail...
1998-03-18 17:59:20 +00:00
Guido van Rossum
f8b4de02a4
When we have no setvbuf(), make the file totally unbuffered using
...
setbuf() if a buffer size of 0 or 1 byte is requested.
1998-03-06 15:32:40 +00:00
Guido van Rossum
dcb5e7f389
Of course, I shouldn't have used lseek() to find out the file's
...
position in new_buffersize(); the correct function to use is ftell().
Thanks to Ben Jackson.
1998-03-03 22:36:10 +00:00
Guido van Rossum
3da3fcef96
Check ferror(), not errno, for fread() error.
1998-02-19 20:46:48 +00:00
Guido van Rossum
f51815426e
Fix problem discovered by Barry: if you hit ^C to
...
sys.stdin.readline(), you get a fatal error (no current thread). This
is because there was a call to PyErr_CheckSignals() while there was no
current thread. I wonder how many more of these we find... I bnetter
go hunting for PyErr_CheckSignals() now...
1997-11-07 19:20:34 +00:00
Guido van Rossum
36f8e2d1db
Use lseek instead of ftell; compensate by adding BUFSIZE
1997-08-21 02:31:25 +00:00
Guido van Rossum
74ba24758e
Reordered list of methods to hopefully put the most frequently used
...
ones near the front.
Also added a missing "return -1" to PyFile_WriteString.
1997-07-13 03:56:50 +00:00
Guido van Rossum
27a60b147c
PyFile_WriteString now returns an error indicator instead of calling
...
PyErr_Clear().
1997-05-22 22:25:11 +00:00
Guido van Rossum
e9eec54798
Fix typo in error checking spotted by Just...
1997-05-22 14:02:25 +00:00
Guido van Rossum
789a1613a0
Add optional 'sizehint' argument to readlines(). After approximately
...
this many bytes have been read, readlines stops. Because of
buffering, the amount of bytes read is usually at least 8K more than
the hint.
Also changed read() and readline() to use PyArg_ParseTuple().
(Note that the *previous* checkin also fixed error handling and
narrowed the range of thread unblocking for all methods using
fread().)
1997-05-10 22:33:55 +00:00
Guido van Rossum
6263d5451c
Rewrite readlines() to speed it up -- about a factor of 2 on my
...
Indigo2, reading a 9Meg file from the local disk.
1997-05-10 22:07:25 +00:00
Guido van Rossum
5449b6e123
Speed up read() (i.e. read till EOF) considerably by doing a stat() to
...
see if we can guess the #bytes until the end of the file. If we
can't, increment the buffer size increments up to 0.5Meg to avoid
realloc'ing too much.
1997-05-09 22:27:31 +00:00
Guido van Rossum
b819914263
Fix by Mark Hammond to enable truncate() on Windows.
1997-05-06 15:23:24 +00:00