summaryrefslogtreecommitdiffstats
path: root/Lib/io.py
Commit message (Collapse)AuthorAgeFilesLines
* Removed redundant max() call.Alexandre Vassalotti2008-05-091-1/+1
| | | | Change suggested by Nick Coghlan.
* Fixed the negative value check in io._BytesIO.seek().Alexandre Vassalotti2008-05-081-1/+1
|
* Cleaned how _BytesIO.read() returns an empty bytes object.Alexandre Vassalotti2008-05-071-1/+1
| | | | Thank you, Guido, for noticing!
* Fixed a small bug introduced by r62778.Alexandre Vassalotti2008-05-061-1/+1
| | | | | | | One of the codepaths of _BytesIO.read() returned a bytearray object, by mistake, when it should always return a bytes object. Interestingly, the fact this bug shown up probably means that some platforms are not using the new C-accelerated io.BytesIO.
* Added fast alternate io.BytesIO implementation and its test suite.Alexandre Vassalotti2008-05-061-9/+66
| | | | | Removed old test suite for StringIO. Modified truncate() to imply a seek to given argument value.
* Merged revisions 62713,62715,62728,62737,62740,62744,62749,62756 via ↵Christian Heimes2008-05-061-45/+38
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | svnmerge from svn+ssh://pythondev@svn.python.org/python/trunk ........ r62713 | georg.brandl | 2008-05-04 23:40:44 +0200 (Sun, 04 May 2008) | 2 lines #2695: Do case-insensitive check for algorithms. ........ r62715 | benjamin.peterson | 2008-05-05 00:39:33 +0200 (Mon, 05 May 2008) | 2 lines Remove method signatures from the docstrings of io.py ........ r62728 | martin.v.loewis | 2008-05-05 19:54:01 +0200 (Mon, 05 May 2008) | 2 lines Revert bogus checkin in r62724 to that file. ........ r62737 | georg.brandl | 2008-05-05 22:59:05 +0200 (Mon, 05 May 2008) | 2 lines #2769: markup glitch. ........ r62740 | georg.brandl | 2008-05-05 23:06:48 +0200 (Mon, 05 May 2008) | 2 lines #2752: fix second example too. ........ r62744 | gregory.p.smith | 2008-05-05 23:53:45 +0200 (Mon, 05 May 2008) | 13 lines Fix a bug introduced in r62627. see issue2760 and issue2632. An assertion in readline() would fail as data was already in the internal buffer even though the socket was in unbuffered read mode. That case is now handled. More importantly, read() has been fixed to not over-recv() and leave newly recv()d data in the _fileobject buffer. The max() vs min() issue in read() is now gone. Neither was correct. On bounded reads, always ask recv() for the exact amount of data we still need. Candidate for backporting to release25-maint along with r62627. ........ r62749 | brett.cannon | 2008-05-06 06:37:31 +0200 (Tue, 06 May 2008) | 3 lines Fix a bug in the handling of the stacklevel argument in warnings.warn() where the stack was being unwound by two levels instead of one each time. ........ r62756 | gregory.p.smith | 2008-05-06 09:05:18 +0200 (Tue, 06 May 2008) | 2 lines fix issue2707 - os.walk docstring example correctness typo. ........
* Fix problems in the io docs noted by Alexandre VassalottiBenjamin Peterson2008-04-141-7/+4
|
* Fleshed out docstrings in the io module, improving the reST one as I went.Benjamin Peterson2008-04-131-144/+296
|
* Remove __repr__ that doesn't have any advantage compared to the standard one.Georg Brandl2008-04-091-3/+0
|
* More docstring fixes, and an XXX.Georg Brandl2008-04-091-4/+5
|
* fixed outdated annotation of readinto in ioBenjamin Peterson2008-04-071-4/+4
|
* Docstring fix.Georg Brandl2008-04-061-2/+2
|
* fix typo in doc stringBenjamin Peterson2008-04-061-2/+2
|
* Clean up the TextIOWrapper code; pick better names; improve documentation.Ka-Ping Yee2008-03-201-123/+121
|
* This is r61508 plus additional fixes to the handling of 'limit'Ka-Ping Yee2008-03-201-64/+84
| | | | | | | | | | in TextIOWrapper.readline(). All tests now pass for me (except for expected skips on darwin: bsddb, bsddb3, cProfile, codecmaps_*, curses, gdbm, largefile, locale, normalization, ossaudiodev, pep277, socketserver, startfile, timeout, urllib2net, urllibnet, winreg, winsound, xmlrpc_net, zipfile64, and the -u largefile part of test_io).
* Revert r61508: it caused test_mailbox to fail on all platforms.Neal Norwitz2008-03-181-82/+64
|
* In TextIOWrapper:Ka-Ping Yee2008-03-181-64/+82
| | | | | | | | - Switch from consuming _decoded_text to advancing an offset into it. - Fix readline() interaction with seek/tell. - Fix readline() handling of 'limit' argument. Add tests for seek/tell after readline().
* Make TextIOWrapper's seek/tell work properly with stateful decoders;Ka-Ping Yee2008-03-181-102/+182
| | | | | | | | document and rename things to make seek/tell workings a little clearer. Add a weird decoder for testing TextIOWrapper's seek/tell methods. Document the getstate/setstate protocol conventions for IncrementalDecoders.
* Patch from jbalogh fixes issue #2282 (misnamed seekable() method).Ka-Ping Yee2008-03-171-1/+1
|
* Remove the "unsafe" flag on peek() -- it is no longer used, becauseKa-Ping Yee2008-03-171-13/+8
| | | | self._read_buf is an immutable bytes object.
* Merged revisions ↵Christian Heimes2008-02-091-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 60481,60485,60489-60492,60494-60496,60498-60499,60501-60503,60505-60506,60508-60509,60523-60524,60532,60543,60545,60547-60548,60552,60554,60556-60559,60561-60562,60569,60571-60572,60574,60576-60583,60585-60586,60589,60591,60594-60595,60597-60598,60600-60601,60606-60612,60615,60617,60619-60621,60623-60625,60627-60629,60631,60633,60635,60647,60650,60652,60654,60656,60658-60659,60664-60666,60668-60670,60672,60676,60678-60695 via svnmerge from svn+ssh://pythondev@svn.python.org/python/trunk ........ r60679 | raymond.hettinger | 2008-02-09 02:18:42 +0100 (Sat, 09 Feb 2008) | 1 line Make ABC containers inherit as documented. ........ r60684 | raymond.hettinger | 2008-02-09 04:34:52 +0100 (Sat, 09 Feb 2008) | 1 line Merge with r60683. ........ r60687 | raymond.hettinger | 2008-02-09 05:37:49 +0100 (Sat, 09 Feb 2008) | 1 line Add -3 warnings that set.copy(), dict.copy(), and defaultdict.copy() will go away in Py3.x ........ r60689 | raymond.hettinger | 2008-02-09 11:04:19 +0100 (Sat, 09 Feb 2008) | 1 line Metaclass declaration is inherited ........ r60691 | raymond.hettinger | 2008-02-09 11:06:20 +0100 (Sat, 09 Feb 2008) | 1 line Temporarily disable this test. It's been broken for a week. ........ r60695 | nick.coghlan | 2008-02-09 16:28:09 +0100 (Sat, 09 Feb 2008) | 1 line Issue 2021: Allow NamedTemporaryFile and SpooledTemporaryFile to be used as context managers. (The NamedTemporaryFile fix should be considered for backporting to 2.5) ........
* Fix issue1753: TextIOWrapper.write writes utf BOM for every string.Alexandre Vassalotti2008-01-071-4/+8
| | | | Patch by Erick Tryzelaar, with slight modifications by me.
* Fix the reset() method of IncrementalNewlineDecoder toAlexandre Vassalotti2007-12-281-0/+1
| | | | also reset self.seennl.
* Added descriptor for builtins.open.__doc__Christian Heimes2007-12-081-0/+10
| | | | Before the change help(open) didn't return anything helpful but the doc string of io.OpenWrapper. Now it shows the user the documentation of io.open.
* Fix the rest of issue 1400, by introducing a proper implementation ofGuido van Rossum2007-12-061-6/+14
| | | | | line buffering. The TextIOWrapper class no longer calls isatty() on every write() call.
* Add an errors parameter to open() and TextIOWrapper() to specify error handling.Guido van Rossum2007-12-031-9/+27
|
* #1535: rename __builtin__ module to builtins.Georg Brandl2007-12-021-1/+1
|
* Rename buffer -> bytearray.Guido van Rossum2007-11-211-6/+6
|
* Oops, I missed this one again (test_univnewlines fails):Amaury Forgeot d'Arc2007-11-191-1/+1
| | | | | | Some incremental decoders return multiple characters, even when fed with only one more byte. In this case the tell() state must subtract the number of extra characters.
* Issue1395: Universal mode used to duplicate newlines when using read(1).Amaury Forgeot d'Arc2007-11-191-89/+116
| | | | | | | | | | "Universal newline" is now an incremental decoder wrapping the initial one, with its own additional buffer (if '\r' is seen at the end of the input). A decoder allows the tell() funtion to record the state of the translation. This also simplifies the readline() process. Now test_netrc passes on Windows, as well as many new tests in test_io.py
* seek() has to accept any int-like numberChristian Heimes2007-11-091-2/+4
|
* Fixed bug #1081: file.seek allows float argumentsChristian Heimes2007-11-081-0/+2
|
* Fixed #1403 where compileall and py_compile choked on an encoding header in ↵Christian Heimes2007-11-081-0/+3
| | | | a py file. Both modules need more unit tests.
* Merging the py3k-pep3137 branch back into the py3k branch.Guido van Rossum2007-11-061-14/+16
| | | | | | | | | | | | | | No detailed change log; just check out the change log for the py3k-pep3137 branch. The most obvious changes: - str8 renamed to bytes (PyString at the C level); - bytes renamed to buffer (PyBytes at the C level); - PyString and PyUnicode are no longer compatible. I.e. we now have an immutable bytes type and a mutable bytes type. The behavior of PyString was modified quite a bit, to make it more bytes-like. Some changes are still on the to-do list.
* Fix typo.Georg Brandl2007-10-301-1/+1
|
* Patch 1329 (partial) by Christian Heimes.Guido van Rossum2007-10-301-4/+9
| | | | | | | | Add a closefd flag to open() which can be set to False to prevent closing the file descriptor when close() is called or when the object is destroyed. Useful to ensure that sys.std{in,out,err} keep their file descriptors open when Python is uninitialized. (This was always a feature in 2.x, it just wasn't implemented in 3.0 yet.)
* Patch 1330 by Christian Heimes (with some TLC applied by myself).Guido van Rossum2007-10-261-14/+4
| | | | | Move most of the messiness with truncate() on Windows into _fileio.c. Still keep the flush() call in io.py though.
* Patch # 1323 by Amaury Forgeot d'Arc.Guido van Rossum2007-10-251-2/+17
| | | | | | This patch corrects a problem in test_file.py on Windows: f.truncate() seeks to the truncation point, but does not empty the buffers. In the test, f.tell() returns -1...
* Patch 1267 by Christian Heimes.Guido van Rossum2007-10-191-0/+12
| | | | | | Move the initialization of sys.std{in,out,err} and __builtin__.open to C code. This solves the problem that "python -S" wouldn't work.
* Patch# 1258 by Christian Heimes: kill basestring.Guido van Rossum2007-10-161-5/+5
| | | | I like this because it makes the code shorter! :-)
* Make the docstring for io.open() a raw string so that the explanation for theBrett Cannon2007-10-151-1/+1
| | | | 'newline' argument is not a jumbled mess of newlines.
* Remove self-referential import.Brett Cannon2007-10-111-2/+1
|
* In rseponse to bug# 1029, force the newline default for StringIO to "\n",Guido van Rossum2007-08-291-1/+1
| | | | so that even on Windows, after s.write("x\n"), s.getvalue() == "x\n".
* Insist that the argument to TextIOWrapper.write() is a basestringGuido van Rossum2007-08-291-0/+3
| | | | | instance. This was effectively already the case, but the error reporting was lousy.
* Commit strict str/bytes distinction.Guido van Rossum2007-08-291-8/+5
| | | | | | | | | From now on, trying to write str to a binary stream is an error (I'm still working on the reverse). There are still (at least) two failing tests: - test_asynchat - test_urllib2_localnet but I'm sure these will be fixed by someone.
* Changes to io.py and socket.py by Christian Heimes.Guido van Rossum2007-08-271-25/+57
| | | | | | | | | - Replace all asserts by ValuleErrors or TypeErrors as appropriate. - Add _checkReadable, _checkWritable methods; these check self.closed too. - Add a test that everything exported by io.py exists, and is either an exception or an IOBase instance (except for the open function). - Default buffering to 1 if isatty() (I had to tweak this to enforce the *default* bit -- GvR).
* Make IOBase (and hence all other classes in io.py) use ABCMeta as its metaclass,Guido van Rossum2007-08-221-1/+2
| | | | so you can use their class .register() method to register virtual subclasses.
* New I/O code from Tony Lownds implement newline feature correctly,Guido van Rossum2007-08-181-50/+160
| | | | and implements .newlines attribute in a 2.x-compatible fashion.
* Fix test_wsgiref that used StringIO and a BufferedReader rather thanNeal Norwitz2007-08-111-1/+2
| | | | | real files. This code assumed that fileno() would succeed which wasn't the case.
* Fall back to ascii if the locale module cannot be loaded.Martin v. Löwis2007-08-111-2/+7
|