Antoine Pitrou
796564c27b
Issue #18112 : PEP 442 implementation (safe object finalization).
13 years ago
Victor Stinner
85c761d3d3
Issue #18408 : Fix fileio_read() on _PyBytes_Resize() failure
bytes is NULL on _PyBytes_Resize() failure
13 years ago
Victor Stinner
14b9b11098
If MS_WIN64 is defined, MS_WINDOWS is also defined: #ifdef can be simplified.
13 years ago
Christian Heimes
91e8b8180d
Check for correct macro, code uses S_ISDIR().
13 years ago
Victor Stinner
3e269397e3
FileIO.readall(): remove trailing space from an exception message
13 years ago
Richard Oudkerk
af7260e81a
Issue #15758 : Fix FileIO.readall() so it no longer has O(n**2) complexity.
13 years ago
Serhiy Storchaka
74f49ab28b
Issue #15989 : Fix several occurrences of integer overflow
when result of PyInt_AsLong() or PyLong_AsLong() narrowed
to int without checks.
This is a backport of changesets 13e2e44db99d and 525407d89277.
13 years ago
Serhiy Storchaka
441d30fac7
Issue #15989 : Fix several occurrences of integer overflow
when result of PyLong_AsLong() narrowed to int without checks.
This is a backport of changesets 13e2e44db99d and 525407d89277.
13 years ago
Serhiy Storchaka
7898043868
Issue #15989 : Fix several occurrences of integer overflow
when result of PyLong_AsLong() narrowed to int without checks.
13 years ago
Victor Stinner
c44057dfbd
Issue #16367 : Fix FileIO.readall() on Windows for files larger than 2 GB
13 years ago
Victor Stinner
23a32ba0e5
Issue #16367 : Fix FileIO.readall() on Windows for files larger than 2 GB
13 years ago
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).
14 years ago
Gregory P. Smith
99716166b1
Fixes Issue #12268 for the io module - File readline, readlines and
read or readall methods no longer lose data when an underlying read
system call is interrupted within an io module object. IOError is no
longer raised due to a read system call returning EINTR from within
these methods.
This is a backport of changeset 781b95159954 from 3.2.
The earlier 2.7 changeset 67dc99a989cd already fixed this for the
builtin python 2.x file object.
14 years ago
Antoine Pitrou
9235b254dc
Issue #15247 : FileIO now raises an error when given a file descriptor pointing to a directory.
14 years ago
Antoine Pitrou
c2ec992698
Issue #15247 : FileIO now raises an error when given a file descriptor pointing to a directory.
14 years ago
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.
14 years ago
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.
14 years ago
Hynek Schlawack
9ed8b4e4ca
#10053 : Don't close FDs when FileIO.__init__ fails
Loosely based on the work by Hirokazu Yamamoto.
14 years ago
Hynek Schlawack
9bd4bf2a3d
#10053 : Don't close FDs when FileIO.__init__ fails
Loosely based on the work by Hirokazu Yamamoto.
14 years ago
Hynek Schlawack
2cc7156515
#4841 : Fix FileIO constructor to honor closefd when called repeatedly
Patch by Victor Stinner.
14 years ago
Hynek Schlawack
877effc298
#4841 : Fix FileIO constructor to honor closefd when called repeatedly
Patch by Victor Stinner.
14 years ago
Antoine Pitrou
a3f4457b17
Speed up reading of small files. This avoids multiple C read() calls on pyc files.
14 years ago
Antoine Pitrou
1334884ff2
Issue #13848 : open() and the FileIO constructor now check for NUL characters in the file name.
Patch by Hynek Schlawack.
14 years ago
Charles-François Natali
d612de10e5
Issue #12760 : Refer to the new 'x' open mode as "exclusive creation" mode.
14 years ago
Charles-François Natali
dc3044c704
Issue #12760 : Add a create mode to open(). Patch by David Townshend.
14 years ago
Antoine Pitrou
c345ce1a69
Issue #10350 : Read and save errno before calling a function which might overwrite it.
Original patch by Hallvard B Furuseth.
14 years ago
Martin v. Löwis
767046aab1
Replace {Get,Set,Has}AttrString with *AttrId.
15 years ago
Ross Lagerwall
59142db6d3
Issue #12797 : Added custom opener parameter to builtin open() and FileIO.open().
15 years ago
Martin v. Löwis
bd928fef42
Rename _Py_identifier to _Py_IDENTIFIER.
15 years ago
Nadeem Vawda
36248154a9
Issue #13159 : Replace FileIO's quadratic-time buffer growth algorithm with a linear-time one.
Also fix the builtin file class and the bz2 module, which used the same algorithm.
15 years ago
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.
15 years ago
Victor Stinner
c5af7730e3
Fix FileIO.readall() (new_buffersize()) for large files
Truncate the buffer size to PY_SSIZE_T_MAX.
15 years ago
Victor Stinner
a2a6477ba0
Fix io.FileIO.readall() on Windows 64 bits
Use Py_off_t type (64 bits) instead of off_t (32 bits).
15 years ago
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.
15 years ago
Victor Stinner
fe9a861e74
fileio_init() checks for failure on conversion to Py_UNICODE*
15 years ago
Victor Stinner
c655a726db
Issue #9611 , #9015 : FileIO.read() clamps the length to INT_MAX on Windows.
15 years ago
Victor Stinner
59729ff609
Issue #9611 , #9015 : FileIO.read(), FileIO.readinto(), FileIO.write() and
os.write() clamp the length to INT_MAX on Windows.
15 years ago
Victor Stinner
e9d44ccb22
Issue #12175 : FileIO.readall() now only reads the file position and size once.
15 years ago
Victor Stinner
5100a405dc
Issue #12175 : FileIO.readall() now raises a ValueError instead of an IOError if
the file is closed.
15 years ago
Victor Stinner
b79f28ccbd
Issue #12175 : FileIO.readall() now raises a ValueError instead of an IOError if
the file is closed.
15 years ago
Victor Stinner
e0daff1c61
Issue #11395 : io.FileIO().write() clamps the data length to 32,767 bytes on
Windows if the file is a TTY to workaround a Windows bug. The Windows console
returns an error (12: not enough space error) on writing into stdout if
stdout mode is binary and the length is greater than 66,000 bytes (or less,
depending on heap usage).
15 years ago
Victor Stinner
7234479580
Issue #9611 : remove useless and dangerous explicit conversion to size_t
15 years ago
Victor Stinner
89e3436606
Issue #10841 : set binary mode on files; the parser translates newlines
On Windows, set the binary mode on stdin, stdout, stderr and all
io.FileIO objects (to not translate newlines, \r\n <=> \n). The Python parser
translates newlines (\r\n => \n).
15 years ago
Victor Stinner
e6edec2371
Issue #9015 , #9611 : FileIO.readinto(), FileIO.write() and os.write() clamp the
length to 2^31-1 on Windows.
15 years ago
Georg Brandl
d62ecbf0ba
Merged revisions 85728,85731,85735,85766-85771,85773,85777 via svnmerge from
svn+ssh://svn.python.org/python/branches/py3k
........
r85728 | georg.brandl | 2010-10-19 20:54:25 +0200 (Di, 19 Okt 2010) | 1 line
#10092 : Properly reset locale in Locale*Calendar classes. The context manager was buggy because setlocale() returns the *new* locale, not the old. Also add a test for this.
........
r85731 | georg.brandl | 2010-10-19 23:07:16 +0200 (Di, 19 Okt 2010) | 1 line
Be consistent in the spelling of thread-safe(ty).
........
r85735 | georg.brandl | 2010-10-20 08:50:19 +0200 (Mi, 20 Okt 2010) | 1 line
Fix r85728: use "" to mean the system default locale, which should work on more systems.
........
r85766 | georg.brandl | 2010-10-21 09:40:03 +0200 (Do, 21 Okt 2010) | 1 line
#10159 : sort completion matches before comparing to dir() result.
........
r85767 | georg.brandl | 2010-10-21 14:49:28 +0200 (Do, 21 Okt 2010) | 1 line
#9095 , #8912 , #8999 : add support in patchcheck for Mercurial checkouts, C file reindenting, and docs whitespace fixing.
........
r85768 | georg.brandl | 2010-10-21 14:59:14 +0200 (Do, 21 Okt 2010) | 1 line
#9919 : fix off-by-one error in lineno command in Misc/gdbinit; also add newline to its output.
........
r85769 | georg.brandl | 2010-10-21 15:01:23 +0200 (Do, 21 Okt 2010) | 1 line
Fix missing import.
........
r85770 | georg.brandl | 2010-10-21 15:29:10 +0200 (Do, 21 Okt 2010) | 1 line
#3077 : fix h2py substitution of character literals.
........
r85771 | georg.brandl | 2010-10-21 15:34:51 +0200 (Do, 21 Okt 2010) | 1 line
#1203650 : allow larger list of files in windows makefile for freeze.
........
r85773 | georg.brandl | 2010-10-21 15:45:52 +0200 (Do, 21 Okt 2010) | 1 line
#4829 : better error message for invalid file mode
........
r85777 | georg.brandl | 2010-10-21 17:44:51 +0200 (Do, 21 Okt 2010) | 1 line
Add .hgeol file for the Mercurial EOL extension.
........
16 years ago
Georg Brandl
1060380ea4
Merged revisions 85768-85771,85773,85777,85823,85825 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/branches/py3k
........
r85768 | georg.brandl | 2010-10-21 14:59:14 +0200 (Do, 21 Okt 2010) | 1 line
#9919 : fix off-by-one error in lineno command in Misc/gdbinit; also add newline to its output.
........
r85769 | georg.brandl | 2010-10-21 15:01:23 +0200 (Do, 21 Okt 2010) | 1 line
Fix missing import.
........
r85770 | georg.brandl | 2010-10-21 15:29:10 +0200 (Do, 21 Okt 2010) | 1 line
#3077 : fix h2py substitution of character literals.
........
r85771 | georg.brandl | 2010-10-21 15:34:51 +0200 (Do, 21 Okt 2010) | 1 line
#1203650 : allow larger list of files in windows makefile for freeze.
........
r85773 | georg.brandl | 2010-10-21 15:45:52 +0200 (Do, 21 Okt 2010) | 1 line
#4829 : better error message for invalid file mode
........
r85777 | georg.brandl | 2010-10-21 17:44:51 +0200 (Do, 21 Okt 2010) | 1 line
Add .hgeol file for the Mercurial EOL extension.
........
r85823 | georg.brandl | 2010-10-24 16:32:45 +0200 (So, 24 Okt 2010) | 1 line
Fix style.
........
r85825 | georg.brandl | 2010-10-24 17:16:02 +0200 (So, 24 Okt 2010) | 1 line
Add documentation about the default warnings filters.
........
16 years ago
Antoine Pitrou
243757eb79
Issue #10180 : Pickling file objects is now explicitly forbidden, since
unpickling them produced nonsensical results.
16 years ago
Antoine Pitrou
594a046b88
Merged revisions 85982 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/branches/py3k
........
r85982 | antoine.pitrou | 2010-10-30 18:19:14 +0200 (sam., 30 oct. 2010) | 4 lines
Issue #10253 : FileIO leaks a file descriptor when trying to open a file
for append that isn't seekable. Patch by Brian Brazil.
........
16 years ago
Antoine Pitrou
735e3b195a
Merged revisions 85982 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/branches/py3k
........
r85982 | antoine.pitrou | 2010-10-30 18:19:14 +0200 (sam., 30 oct. 2010) | 4 lines
Issue #10253 : FileIO leaks a file descriptor when trying to open a file
for append that isn't seekable. Patch by Brian Brazil.
........
16 years ago
Benjamin Peterson
bbb0412ad1
if FileIO.__init__ fails, close fd
16 years ago