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
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
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
Collin Winter
42dae6a89b
Make readonly members defined in C throw an AttributeError on modification. This brings them into sync with Python-level attributes. Fixes bug #1687163 .
2007-03-28 21:44:53 +00:00
Guido van Rossum
d84da1b67a
More fixes related to removal of exception slicing.
2007-03-28 21:03:48 +00:00
Guido van Rossum
782ff275b8
Fix errors in bsddb3 tests due to removal of exception slicing.
...
(There was also a segfault but it disappeared when the tests
stopped erroring out; I presume the segfault is a pre-existing
problem somewhere in a destructor.)
2007-03-28 21:02:43 +00:00
Guido van Rossum
cef2098cfa
Moving xreload to the sandbox for now.
2007-03-28 00:30:15 +00:00
Guido van Rossum
e27dc72308
By default, != returns the opposite of ==, unless the latter returns
...
NotImplemented.
(Is this worth backporting to 2.6? It seems so useful...!)
2007-03-27 22:37:34 +00:00
Collin Winter
e33761dcaa
Fix two bugs related to the remove of exception subscripting.
2007-03-27 04:55:27 +00:00
Brett Cannon
ca477b2280
When removing indexing/slicing on exceptions some places were changed
...
inappropriately from ``e[0]`` to ``e.message`` instead of ``e.args[0]``. The
reason it needs to be the last option is the dichotomy of 'message' and 'args':
'message' can be the empty string but args[0] can have a value if more than one
argument was passed.
2007-03-21 22:26:20 +00:00
Collin Winter
390d29ca74
Remove isCallable() and sequenceIncludes() from the operator module.
2007-03-21 20:10:51 +00:00
Collin Winter
670e692134
Patch #1680961 : remove sys.exitfunc and replace it with a private C API. Also, reimplement atexit in C so it can take advantage of this private API.
2007-03-21 02:57:17 +00:00
Guido van Rossum
89df245607
Make test_socket_ssl.py pass by fixing some code that was
...
incorrectly assuming that err.message was the Py3k way of
writing err[0] in 2.x. The correct spelling is err.args[0].
2007-03-19 22:26:27 +00:00
Guido van Rossum
7cba8508af
Use input() now that it is available.
2007-03-19 22:23:59 +00:00
Guido van Rossum
d16e81aabe
Fix the compiler package w.r.t. the new metaclass syntax.
...
(It is still broken w.r.t. the new nonlocal keyword.)
Remove a series of debug prints I accidentally left in test_ast.py.
2007-03-19 17:56:01 +00:00
Georg Brandl
dde002899d
Make ELLIPSIS a separate token. This makes it a syntax error to write ". . ." for Ellipsis.
2007-03-18 19:01:53 +00:00
Guido van Rossum
52cc1d838f
Implement PEP 3115 -- new metaclass syntax and semantics.
...
The compiler package hasn't been updated yet; test_compiler.py fails.
Otherwise all tests seem to be passing now. There are no occurrences
of __metaclass__ left in the standard library.
Docs have not been updated.
2007-03-18 15:41:51 +00:00
Guido van Rossum
ef17c16b36
Bug 1679498: remove unused instance variables _readable, _writable and
...
_seekable.
2007-03-18 03:42:15 +00:00
Guido van Rossum
bb09b21250
Bug 1679498: unset variable 'bs'.
2007-03-18 03:36:28 +00:00
Guido van Rossum
c819dea40d
Add some XXX comments and fix BufferedReader signature.
2007-03-15 18:59:31 +00:00
Georg Brandl
e32b4224d0
Patch #1591665 : implement the __dir__() special function lookup in PyObject_Dir.
2007-03-10 22:13:27 +00:00
Collin Winter
7afaa88ebc
Move test_unittest, test_doctest and test_doctest2 higher up in the test order
2007-03-08 19:54:43 +00:00
Guido van Rossum
49dc35ba73
Fix another unittest that broke due to dict views (more precisely, due
...
to the cowboy way they are currently hacked in).
2007-03-08 01:17:51 +00:00
Guido van Rossum
de3bc7c565
Fix embarrassing syntax mix.
2007-03-08 01:02:00 +00:00
Guido van Rossum
a9e2024b84
Check in Daniel Stutzbach's _fileio.c and test_fileio.py
...
(see SF#1671314) with small tweaks.
The io module now uses this instead of its own implementation
of the FileIO class, if it can import _fileio.
2007-03-08 00:43:48 +00:00