Guido van Rossum
4d2adcca52
Make it compile with C89.
2007-04-17 21:58:50 +00:00
Guido van Rossum
2fa74bbad5
If $PYTHONNEWIO is set and nonempty,
...
io.py is used for open() and sys.std{in,out,err}.
Note that this currently breaks about 25 tests.
2007-04-17 21:49:04 +00:00
Neal Norwitz
9d72bb452b
Remove functions in string module that are also string methods. Also remove:
...
* all calls to functions in the string module (except maketrans)
* everything from stropmodule except for maketrans() which is still used
2007-04-17 08:48:32 +00:00
Neal Norwitz
ff11334927
Remove the SlowParser class because it depended on the xmllib module
...
which was removed.
Use string methods rather than the string module.
2007-04-17 08:42:15 +00:00
Neal Norwitz
53855c6495
Remove the xmllib module that was obsolete.
2007-04-17 08:39:58 +00:00
Neal Norwitz
e6c6e3d9c5
Remove old string module
2007-04-17 08:20:53 +00:00
Neal Norwitz
9b483f153a
Remove ancient platforms: AIX 3 and Irix 5. (AIX 4 and Irix 6 remain.)
2007-04-17 08:19:58 +00:00
Guido van Rossum
d76e7796c9
Instead of pickling the whole decoder, use the new getstate/setstate API.
2007-04-17 02:38:04 +00:00
Walter Dörwald
3abcb013b8
Apply SF patch #1698994 : Add getstate() and setstate()
...
methods to incrementalcodecs.
Also forward port r54786 (fix the incremental
utf_8_sig decoder).
2007-04-16 22:10:50 +00:00
Guido van Rossum
8981ad05c0
Check in the inevitable change to the version number.
...
I'll add this step to PEP 306.
2007-04-16 17:02:00 +00:00
Nick Coghlan
650f0d06d3
Hide list comp variables and support set comprehensions
2007-04-15 12:05:43 +00:00
Guido van Rossum
6ef6306dd6
Oops, don't test for a name attribute here. That's a higher-level feature.
2007-04-13 19:02:54 +00:00
Guido van Rossum
13633bb8c5
Support name and mode attributes on all file types.
...
Don't read more than one line when reading text from a tty device.
Add peek() and read1() methods.
Return str instead of unicode when return ASCII characters in text mode.
2007-04-13 18:42:35 +00:00
Guido van Rossum
913dd0be52
struct.unpack() allows a bytes string too (if it has the right size).
2007-04-13 03:33:53 +00:00
Guido van Rossum
98f9746740
Support marshal.dump(x, f) where f is not a real file.
...
Support ord(b) where b is a 1-byte string.
In zipfile.py, work around bytes being ints instead of chars, sometimes.
2007-04-13 03:31:13 +00:00
Guido van Rossum
84d79ddce2
Disallow u"..." + b"..." and b"..." + u"...".
2007-04-13 02:23:57 +00:00
Guido van Rossum
ad7d8d10b7
Rough and dirty job -- allow concatenation of bytes and arbitrary
...
buffer-supporting objects (Unicode always excluded), and also of
str and bytes.
(For some reason u"" + b"" doesn't fail, I'll investigate later.)
2007-04-13 01:39:34 +00:00
Guido van Rossum
dc0b1a1069
Make a few more tests pass with the new I/O library.
...
Fix the truncate() semantics -- it should not affect the current position.
Switch wave.py/chunk.py to struct.unpack_from() to support bytes.
Don't use writelines() on binary files (test_fileinput.py).
2007-04-12 22:55:07 +00:00
Guido van Rossum
b6f1fdc90c
Clean up trailing whitespace.
2007-04-12 22:49:52 +00:00
Guido van Rossum
682faf8fe0
Fix most XXX remarks.
2007-04-12 14:56:58 +00:00
Guido van Rossum
31c3a57480
Test closed, mode attribute; don't test __exit__().
2007-04-12 14:51:49 +00:00
Guido van Rossum
d410395ea7
Make sure that writing an array instance returns the number of bytes,
...
not the number of array elements.
2007-04-12 05:44:49 +00:00
Guido van Rossum
aa43ed95cd
TextIO improvement:
...
- 25% speed increse in tell();
- f.seek(0, 1) now maps to f.seek(f.tell(), 0) instead of to f.tell().
2007-04-12 05:24:24 +00:00
Georg Brandl
57b39e0916
Bug #1697782 : remove all remaining code that uses types.InstanceType.
2007-04-11 19:24:50 +00:00
Guido van Rossum
b5ddcfd2a2
Make array().tofile() work with a new I/O object.
2007-04-11 17:08:28 +00:00
Guido van Rossum
d0712817ac
Re-enable cleanup code.
2007-04-11 16:32:43 +00:00
Guido van Rossum
b9c4c3e455
Speed up next() by disabling snapshot updating then.
2007-04-11 16:07:50 +00:00
Guido van Rossum
cba608cadb
More efficient implementation of tell(); _read_chunk() doesn't have to
...
call self.buffer.tell().
2007-04-11 14:19:59 +00:00
Guido van Rossum
0dd32e246c
Real pickling for bytes.
...
Restore complex pickling.
Use cPickle in io.py.
2007-04-11 05:40:58 +00:00
Guido van Rossum
0ad0812edb
An example of action-at-a-distance: fix the problems I had in test_io.py
...
without touching io.py or test_io.py. The cause of the failure was that
bytes objects didn't pickle right. As a stop-gap measure, I'm providing
bytes pickling via copy_reg. Eventually, we should use a more efficient
protocol, e.g. __reduce_ex__ or __getstate__/__setstate__.
2007-04-11 04:37:43 +00:00
Guido van Rossum
9b76da6a8f
Checkpoint so I can continue to work on this at a different box.
...
There is somewhat working (but slow) code supporting seek/tell for text files,
but extensive testing exposes a bug I can't nail down.
2007-04-11 01:09:03 +00:00
Guido van Rossum
8742977b33
truncate() returns the new size and position.
...
write() returns the number of bytes/characters written/buffered.
FileIO.close() calls self.flush().
Implement readinto() for buffered readers.
Tests th check all these.
Test proper behavior of __enter__/__exit__.
2007-04-10 21:06:59 +00:00
Guido van Rossum
34d69e57e3
Skip large file tests on Windowns and OSX.
...
Reduce large file size to 2**31 (and a bit).
2007-04-10 20:08:41 +00:00
Guido van Rossum
53807dabf0
Implement long positioning (Unix only, probably).
...
Etc., etc.
2007-04-10 19:01:47 +00:00
Guido van Rossum
cce92b27d6
BufferedIOBase and TextIOBase should derive from IOBase, not from RawIOBase!
2007-04-10 14:41:39 +00:00
Guido van Rossum
141f767d46
More cleanup. Renamed BlockingIO to BlockingIOError.
...
Removed unused _PyFileIO class.
Changed inheritance structure.
TODO: do the same kinds of things to TextIO.
2007-04-10 00:22:16 +00:00
Guido van Rossum
ebea9beab3
Bytes should never equal unicode.
...
Add tests for str <cmpop> bytes.
2007-04-09 00:49:13 +00:00
Guido van Rossum
343e97ff7f
For Make Benefit Glorious Nation of Backwards Compatibility,
...
bytes objects can now be compared to anything that supports the buffer API.
2007-04-09 00:43:24 +00:00
Guido van Rossum
62cbc8a261
Make sure that a forked child process exits even if it raises an exception.
2007-04-09 00:41:25 +00:00
Guido van Rossum
933520b5ba
Fix a place where it's pretty clear that a binary open mode was intended.
...
(The new I/O library revealed the problem.)
2007-04-09 00:00:23 +00:00
Guido van Rossum
4f0db6e4a1
Cleanup.
...
Add closed attribute.
Support int argument to open() -- wrapping a file descriptor.
For b/w compat, support readline(n).
Support readlines() and readlines(n).
Flush on __del__.
Added some XXX comments.
2007-04-08 23:59:06 +00:00
Guido van Rossum
b04281592e
Make it possible to instantiate a _FileIO() with an integer file descriptor
...
instead of a filename.
Add a 'closed' attribute.
2007-04-08 17:44:42 +00:00
Guido van Rossum
b8551ae68f
Somehow this contained a bogus reference to "exceptions" which caused
...
"import exceptions" to behave bizarrely.
2007-04-07 03:14:46 +00:00
Guido van Rossum
756aa93763
A class used as an exception should inherit from Exception.
...
(Should be backported to 2.6, really.)
2007-04-07 03:04:01 +00:00
Guido van Rossum
9be5597abf
Add some backwards compatibility stuff.
...
This now appears to work when io.open is substituted for the real open
in fileinput.py -- at least the latter's unit tests pass.
2007-04-07 02:59:27 +00:00
Guido van Rossum
76c5d4d72d
Checkpoint.
...
Some cleanup of test_io.py and io.py.
Added seeking to buffered reader and writer, but no tests yet.
2007-04-06 19:10:29 +00:00
Guido van Rossum
186685905c
Get rid of duplicate definition of BufferedIOBase.
2007-04-06 18:11:47 +00:00
Guido van Rossum
78892e4613
Added a working Text I/O layer, by Mark Russell.
...
This is essentially a checkpoint.
2007-04-06 17:31:18 +00:00
Fred Drake
0e074483e7
make the markup match that of the trunk to avoid insane spread of
...
mystery italics
2007-03-29 23:11:24 +00:00
Guido van Rossum
6b18a5bb32
Fix refcounting bug reported by Amaury Forgeot d'Arc.
2007-03-29 20:49:57 +00:00