Andrew Svetlov
a191959849
Issue #16714 : use 'raise' exceptions, don't 'throw'.
...
Patch by Serhiy Storchaka.
2012-12-18 21:27:16 +02:00
Andrew Svetlov
5b89840d9c
Issue #16714 : use 'raise' exceptions, don't 'throw'.
...
Patch by Serhiy Storchaka.
2012-12-18 21:26:36 +02:00
Andrew Svetlov
737fb89dd1
Issue #16714 : use 'raise' exceptions, don't 'throw'.
...
Patch by Serhiy Storchaka.
2012-12-18 21:14:22 +02:00
Victor Stinner
292c835548
Issue #15478 : Raising an OSError doesn't decode or encode the filename anymore
...
Pass the original filename argument to OSError constructor, instead of trying
to encode it to or decode it from the filesystem encoding. This change avoids
an additionnal UnicodeDecodeError on Windows if the filename cannot be decoded
from the filesystem encoding (ANSI code page).
2012-10-30 02:17:38 +01:00
Christian Heimes
743e0cd6b5
Issue #16166 : Add PY_LITTLE_ENDIAN and PY_BIG_ENDIAN macros and unified
...
endianess detection and handling.
2012-10-17 23:52:17 +02:00
Jesus Cea
dc469454ec
Closes #15488 : Closed files keep their buffer alive
2012-10-04 12:37:56 +02:00
Ezio Melotti
6d10b4d591
#15796 : merge with 3.2.
2012-09-18 07:21:18 +03:00
Ezio Melotti
16d2b47837
#15796 : Fix \n in readline docstring. Patch by Serhiy Storchaka.
2012-09-18 07:20:18 +03:00
Christian Heimes
f47d79fec1
Fixed reference leak in error branch of _bufferedreader_read_all(). The variable data can contain a bytes object but it wasn't cleaned up when PyList_New() failed. CID 715364
2012-09-10 17:46:09 +02:00
Christian Heimes
89ff3c7f20
Fixed out-of-bounce write to rawmode buffer. The fixed size buffer wasn't enlarged for the new 'x' flag. The buffer may contain the 5 flags xrwa+ and the \0 byte
2012-09-10 03:50:48 +02:00
Stefan Krah
ea94ba45fa
Merge 3.2.
2012-09-08 11:19:27 +02:00
Stefan Krah
96efdd422c
Issue #15868 : Fix refleak in bytesio.c (Coverity #715365 ).
2012-09-08 11:12:33 +02:00
Antoine Pitrou
11946fbe80
Issue #15841 : The readable(), writable() and seekable() methods of BytesIO
...
and StringIO objects now raise ValueError when the object has been closed.
Patch by Alessandro Moura.
2012-09-05 20:13:48 +02:00
Antoine Pitrou
1d857453b7
Issue #15841 : The readable(), writable() and seekable() methods of BytesIO
...
and StringIO objects now raise ValueError when the object has been closed.
Patch by Alessandro Moura.
2012-09-05 20:11:49 +02:00
Antoine Pitrou
721738fbee
Issue #15604 : Update uses of PyObject_IsTrue() to check for and handle errors correctly.
...
Patch by Serhiy Storchaka.
2012-08-15 23:20:39 +02:00
Antoine Pitrou
6f430e4963
Issue #15604 : Update uses of PyObject_IsTrue() to check for and handle errors correctly.
...
Patch by Serhiy Storchaka.
2012-08-15 23:18:25 +02:00
Victor Stinner
d1f9352bd4
(Merge 3.2) open() / TextIOWrapper doc: make it explicit than newline='\n'
...
doesn't translate newlines on output.
2012-08-04 01:22:07 +02:00
Victor Stinner
401e17d0f0
open() / TextIOWrapper doc: make it explicit than newline='\n' doesn't
...
translate newlines on output.
2012-08-04 01:18:56 +02:00
Antoine Pitrou
3c25dfbf13
Make TextIOWrapper's documentation clearer by copying the newline argument's description from open().
2012-08-04 00:56:19 +02:00
Antoine Pitrou
0c1c0d42dc
Make TextIOWrapper's documentation clearer by copying the newline argument's description from open().
2012-08-04 00:55:38 +02:00
Antoine Pitrou
57911f6c1a
Issue #15489 : Add a __sizeof__ implementation for BytesIO objects.
...
Patch by Serhiy Storchaka.
2012-07-30 00:01:44 +02:00
Antoine Pitrou
8f328d0c1d
Issue #15489 : Add a __sizeof__ implementation for BytesIO objects.
...
Patch by Serhiy Storchaka.
2012-07-30 00:01:06 +02:00
Antoine Pitrou
a264384fe6
Issue #15487 : Add a __sizeof__ implementation for buffered I/O objects.
...
Patch by Serhiy Storchaka.
2012-07-29 19:04:57 +02:00
Antoine Pitrou
10f0c50a0b
Issue #15487 : Add a __sizeof__ implementation for buffered I/O objects.
...
Patch by Serhiy Storchaka.
2012-07-29 19:02:46 +02:00
Florent Xicluna
109d57358e
Issue #13248 : io: Remove obsolete argument "max_buffer_size" of BufferedWriter and BufferedRWPair.
2012-07-07 17:03:22 +02:00
Antoine Pitrou
7d7f40c613
Issue #15247 : FileIO now raises an error when given a file descriptor pointing to a directory.
2012-07-06 18:52:58 +02:00
Antoine Pitrou
9235b254dc
Issue #15247 : FileIO now raises an error when given a file descriptor pointing to a directory.
2012-07-06 18:48:24 +02:00
Gregory P. Smith
990a5feba7
Fixes issue #12268 : File readline, readlines and read() or readall() methods
...
no longer lose data when an underlying read system call is interrupted.
IOError is no longer raised due to a read system call returning EINTR
from within these methods.
2012-06-24 00:23:47 -07:00
Gregory P. Smith
5135992164
Fixes issue #12268 : File readline, readlines and read() or readall() methods
...
no longer lose data when an underlying read system call is interrupted.
IOError is no longer raised due to a read system call returning EINTR
from within these methods.
2012-06-23 23:55:39 -07:00
Jesus Cea
9436361e4c
Closes #10142 : Support for SEEK_HOLE/SEEK_DATA
2012-06-22 18:32:07 +02:00
Hynek Schlawack
7f59fd7c7c
Simplify code in fileio_init
...
If an identical code line is in both at the end of if and else, it can as well
stand after the block. :) The code is from 464cf523485e, I didn't see it before
checking the commits in the web interface of course.
2012-06-22 09:32:22 +02:00
Hynek Schlawack
69168354c2
#10053 : Don't close FDs when FileIO.__init__ fails
...
Loosely based on the work by Hirokazu Yamamoto.
2012-06-21 20:58:31 +02:00
Hynek Schlawack
9ed8b4e4ca
#10053 : Don't close FDs when FileIO.__init__ fails
...
Loosely based on the work by Hirokazu Yamamoto.
2012-06-21 20:20:25 +02:00
Victor Stinner
f86a5e8a93
Close #11022 : TextIOWrapper doesn't call locale.setlocale() anymore
...
open() and io.TextIOWrapper are now calling locale.getpreferredencoding(False)
instead of locale.getpreferredencoding() in text mode if the encoding is not
specified. Don't change temporary the locale encoding using locale.setlocale(),
use the current locale encoding instead of the user preferred encoding.
Explain also in open() documentation that locale.getpreferredencoding(False) is
called if the encoding is not specified.
2012-06-05 13:43:22 +02:00
Hynek Schlawack
9866d96e48
#4841 : Fix FileIO constructor to honor closefd when called repeatedly
...
Patch by Victor Stinner.
2012-05-25 10:27:43 +02:00
Hynek Schlawack
2cc7156515
#4841 : Fix FileIO constructor to honor closefd when called repeatedly
...
Patch by Victor Stinner.
2012-05-25 10:05:53 +02:00
Jesus Cea
990eff0776
Backing out 86dc014cdd74. Not ready yet
2012-04-26 17:05:31 +02:00
Jesus Cea
2b47f0a23f
Close #10142 : Support for SEEK_HOLE/SEEK_DATA
2012-04-26 16:39:35 +02:00
Antoine Pitrou
a3f4457b17
Speed up reading of small files. This avoids multiple C read() calls on pyc files.
2012-04-17 13:50:58 +02:00
Ross Lagerwall
0f9eec19ee
Don't Py_DECREF NULL variable in io.IncrementalNewlineDecoder.
...
Found with Clang's Static Analyzer.
2012-04-07 07:09:57 +02:00
Antoine Pitrou
6211b88161
Issue #14437 : Fix building the _io module under Cygwin.
2012-03-31 23:50:31 +02:00
Antoine Pitrou
d0acb411ef
Issue #14387 : Do not include accu.h from Python.h.
2012-03-22 14:42:18 +01:00
Brett Cannon
efb00c0cc1
Issue #14153 Create _Py_device_encoding() to prevent _io from having to import
...
the os module.
2012-02-29 18:31:31 -05:00
Éric Araujo
408026c7e8
Merge 3.2
2012-02-26 04:07:37 +01:00
Éric Araujo
fab976624d
Fix typo in “seperat{or,ion}”
2012-02-26 02:14:08 +01:00
Benjamin Peterson
23d7f12ffb
use new generic __dict__ descriptor implementations
2012-02-19 20:02:57 -05:00
Antoine Pitrou
7ab4af0427
Issue #13848 : open() and the FileIO constructor now check for NUL characters in the file name.
...
Patch by Hynek Schlawack.
2012-01-29 18:43:36 +01:00
Antoine Pitrou
1334884ff2
Issue #13848 : open() and the FileIO constructor now check for NUL characters in the file name.
...
Patch by Hynek Schlawack.
2012-01-29 18:36:34 +01:00
Antoine Pitrou
bb5b92d324
Merge refleak fixes from 3.2
2012-01-18 16:19:19 +01:00
Antoine Pitrou
fc1b6f0078
Fix the _io module leaking references when a sub-interpreter is created.
2012-01-18 16:13:56 +01:00
Charles-François Natali
d612de10e5
Issue #12760 : Refer to the new 'x' open mode as "exclusive creation" mode.
2012-01-14 11:51:00 +01:00
Charles-François Natali
dc3044c704
Issue #12760 : Add a create mode to open(). Patch by David Townshend.
2012-01-09 22:40:02 +01:00
Antoine Pitrou
ab0e9f7089
Issue #10350 : Read and save errno before calling a function which might overwrite it.
...
Original patch by Hallvard B Furuseth.
2011-12-16 12:29:37 +01:00
Antoine Pitrou
c345ce1a69
Issue #10350 : Read and save errno before calling a function which might overwrite it.
...
Original patch by Hallvard B Furuseth.
2011-12-16 12:28:32 +01:00
Victor Stinner
f8facacf30
Fix compiler warnings
2011-11-22 02:30:47 +01:00
Antoine Pitrou
7fe601c5bf
Issue #13322 : Fix BufferedWriter.write() to ensure that BlockingIOError is
...
raised when the wrapped raw file is non-blocking and the write would block.
Previous code assumed that the raw write() would raise BlockingIOError, but
RawIOBase.write() is defined to returned None when the call would block.
Patch by sbt.
2011-11-21 20:22:01 +01:00
Antoine Pitrou
58fcf9f801
Issue #13322 : Fix BufferedWriter.write() to ensure that BlockingIOError is
...
raised when the wrapped raw file is non-blocking and the write would block.
Previous code assumed that the raw write() would raise BlockingIOError, but
RawIOBase.write() is defined to returned None when the call would block.
Patch by sbt.
2011-11-21 20:16:44 +01:00
Victor Stinner
9e30aa52fd
Fix misuse of PyUnicode_GET_SIZE() => PyUnicode_GET_LENGTH()
...
And PyUnicode_GetSize() => PyUnicode_GetLength()
2011-11-21 02:49:52 +01:00
Antoine Pitrou
e532456965
Issue #13393 : In TextIOWrapper.read(n), try to read `n` characters as
...
once rather than limit ourselves to the default chunk size.
2011-11-19 00:39:01 +01:00
Antoine Pitrou
56a220ae4e
Issue #13393 : BufferedReader.read1() now asks the full requested size to
...
the raw stream instead of limiting itself to the buffer size.
2011-11-16 00:56:10 +01:00
Antoine Pitrou
5c398e8395
Restore performance of special casings for utf-16 and utf-32 in TextIOWrapper
2011-11-13 04:11:37 +01:00
Antoine Pitrou
c28e2e53ba
In text I/O, optimize scanning for new lines with 1-byte unicode chars
2011-11-13 03:53:42 +01:00
Antoine Pitrou
c1b0bfdb04
Fix memory leak in io.StringIO
2011-11-12 22:34:28 +01:00
Antoine Pitrou
de20b0b50e
Issue #13149 : Speed up append-only StringIO objects.
...
This is very similar to the "lazy strings" idea.
2011-11-10 21:47:38 +01:00
Martin v. Löwis
767046aab1
Replace {Get,Set,Has}AttrString with *AttrId.
2011-10-14 15:35:36 +02:00
Ross Lagerwall
59142db6d3
Issue #12797 : Added custom opener parameter to builtin open() and FileIO.open().
2011-10-31 20:34:46 +02:00
Martin v. Löwis
bd928fef42
Rename _Py_identifier to _Py_IDENTIFIER.
2011-10-14 10:20:37 +02:00
Nadeem Vawda
72d6a13413
Merge #13159 : Replace FileIO's quadratic-time buffer growth algorithm with a linear-time one.
...
Also fix the bz2 module, which suffered from the same problem.
2011-10-13 13:38:14 +02:00
Nadeem Vawda
d41a98bdd9
Issue #13159 : Replace FileIO's quadratic-time buffer growth algorithm with a linear-time one.
...
Also fix the bz2 module, whose classes used the same algorithm.
2011-10-13 13:34:16 +02:00
Antoine Pitrou
6b4883dec0
PEP 3151 / issue #12555 : reworking the OS and IO exception hierarchy.
2011-10-12 02:54:14 +02:00
Victor Stinner
c5af7730e3
Fix FileIO.readall() (new_buffersize()) for large files
...
Truncate the buffer size to PY_SSIZE_T_MAX.
2011-10-11 23:00:31 +02:00
Victor Stinner
a2a6477ba0
Fix io.FileIO.readall() on Windows 64 bits
...
Use Py_off_t type (64 bits) instead of off_t (32 bits).
2011-10-11 22:45:02 +02:00
Victor Stinner
c4f281eba3
Fix misuse of PyUnicode_GET_SIZE, use PyUnicode_GET_LENGTH instead
2011-10-11 22:11:42 +02:00
Martin v. Löwis
afe55bba33
Add API for static strings, primarily good for identifiers.
...
Thanks to Konrad Schöbel and Jasper Schulz for helping with the mass-editing.
2011-10-09 10:38:36 +02:00
Martin v. Löwis
c47adb04b3
Change PyUnicode_KIND to 1,2,4. Drop _KIND_SIZE and _CHARACTER_SIZE.
2011-10-07 20:55:35 +02:00
Charles-François Natali
42c28cdd1d
Issue #13070 : Fix a crash when a TextIOWrapper caught in a reference cycle
...
would be finalized after the reference to its underlying BufferedRWPair's
writer got cleared by the GC.
2011-10-05 19:53:43 +02:00
Antoine Pitrou
1e44fecc52
Issue #13087 : BufferedReader.seek() now always raises UnsupportedOperation
...
if the underlying raw stream is unseekable, even if the seek could be
satisfied using the internal buffer. Patch by John O'Connor.
2011-10-04 12:26:20 +02:00
Charles-François Natali
b619bb27ed
Issue #13070 : Fix a crash when a TextIOWrapper caught in a reference cycle
...
would be finalized after the reference to its underlying BufferedRWPair's
writer got cleared by the GC.
2011-10-05 19:55:56 +02:00
Victor Stinner
e1335c711c
Fix usage og PyUnicode_READY()
2011-10-04 20:53:03 +02:00
Antoine Pitrou
bf009f0bce
Issue #13087 : BufferedReader.seek() now always raises UnsupportedOperation
...
if the underlying raw stream is unseekable, even if the seek could be
satisfied using the internal buffer. Patch by John OConnor.
2011-10-04 12:28:52 +02:00
Victor Stinner
fe9a861e74
fileio_init() checks for failure on conversion to Py_UNICODE*
2011-09-29 23:19:04 +02:00
Victor Stinner
f7b8cb605d
_io.textio: fix character type, use Py_UCS4 instead of Py_UNICODE
2011-09-29 03:28:17 +02:00
Martin v. Löwis
d63a3b8beb
Implement PEP 393.
2011-09-28 07:41:54 +02:00
Benjamin Peterson
6d8f744730
merge 3.2 ( #1616 )
2011-09-06 07:56:47 -04:00
Benjamin Peterson
f22913b8c3
cast to getter
2011-09-06 07:55:34 -04:00
Benjamin Peterson
9fd5374d4e
merge 3.2 ( #12878 )
2011-09-03 09:32:24 -04:00
Benjamin Peterson
f6f3a35447
add a __dict__ descr for IOBase ( closes #12878 )
2011-09-03 09:26:20 -04:00
Antoine Pitrou
e8bb1a0229
Issue #12213 : Fix a buffering bug with interleaved reads and writes that
...
could appear on BufferedRandom streams.
2011-08-20 14:52:04 +02:00
Antoine Pitrou
e05565ec5a
Issue #12213 : Fix a buffering bug with interleaved reads and writes that
...
could appear on BufferedRandom streams.
2011-08-20 14:39:23 +02:00
Antoine Pitrou
d42c1d09e9
Issue #12591 : Allow io.TextIOWrapper to work with raw IO objects (without
...
a read1() method), and add a *write_through* parameter to
mandate unbuffered writes.
2011-07-23 21:50:21 +02:00
Antoine Pitrou
e96ec68101
Issue #12591 : Allow io.TextIOWrapper to work with raw IO objects (without
...
a read1() method), and add an undocumented *write_through* parameter to
mandate unbuffered writes.
2011-07-23 21:46:35 +02:00
Antoine Pitrou
90ce72dd06
Raise ValueError when attempting to set the _CHUNK_SIZE attribute of a TextIOWrapper to a huge value, not TypeError.
2011-07-13 21:08:56 +02:00
Antoine Pitrou
cb4ae815b5
Raise ValueError when attempting to set the _CHUNK_SIZE attribute of a TextIOWrapper to a huge value, not TypeError.
2011-07-13 21:07:49 +02:00
Victor Stinner
d9fc85db7f
(merge 3.2) Issue #9611 , #9015 : FileIO.read() clamps the length to INT_MAX on Windows.
2011-07-05 11:34:18 +02:00
Victor Stinner
c655a726db
Issue #9611 , #9015 : FileIO.read() clamps the length to INT_MAX on Windows.
2011-07-05 11:31:49 +02:00
Victor Stinner
bc93a116eb
Close #12229 : Remove an unused argument of _bufferedreader_peek_unlocked(),
...
io.BufferedReader._peek_unlocked(). Patch written by John O'Connor.
2011-06-01 00:01:24 +02:00
Victor Stinner
b57f108b03
Issue #12175 : BufferedReader.read(-1) now calls raw.readall() if available.
2011-05-26 00:19:38 +02:00
Victor Stinner
e9d44ccb22
Issue #12175 : FileIO.readall() now only reads the file position and size once.
2011-05-26 00:16:44 +02:00
Victor Stinner
d2780aedce
(Merge 3.2) Issue #12175 : RawIOBase.readall() now returns None if read()
...
returns None.
2011-05-25 22:51:16 +02:00
Victor Stinner
988512cfd7
(Merge 3.1) Issue #12175 : RawIOBase.readall() now returns None if read()
...
returns None.
2011-05-25 22:49:15 +02:00