Commit Graph

62 Commits

Author SHA1 Message Date
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
Éric Araujo e64052176d Merge follow-up for #11254 and other changes from 3.2 2011-11-03 05:17:11 +01:00
Éric Araujo 3924230498 Fix typo 2011-11-03 00:08:48 +01:00
Ross Lagerwall 59142db6d3 Issue #12797: Added custom opener parameter to builtin open() and FileIO.open(). 2011-10-31 20:34:46 +02:00
Antoine Pitrou 24d659daaf Use InterruptedError instead of checking for EINTR 2011-10-23 23:49:42 +02:00
Antoine Pitrou 6b4883dec0 PEP 3151 / issue #12555: reworking the OS and IO exception hierarchy. 2011-10-12 02:54:14 +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
Victor Stinner b57f108b03 Issue #12175: BufferedReader.read(-1) now calls raw.readall() if available. 2011-05-26 00:19:38 +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
Victor Stinner a80987f20d Issue #12175: RawIOBase.readall() now returns None if read() returns None. 2011-05-25 22:47:16 +02:00
Antoine Pitrou d843c2d86f Merged revisions 88610 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/branches/py3k

........
  r88610 | antoine.pitrou | 2011-02-25 22:24:11 +0100 (ven., 25 févr. 2011) | 4 lines

  Issue #10956: Buffered I/O classes retry reading or writing after a signal
  has arrived and the handler returned successfully.
........
2011-02-25 21:34:39 +00:00
Antoine Pitrou 707ce82cab Issue #10956: Buffered I/O classes retry reading or writing after a signal
has arrived and the handler returned successfully.
2011-02-25 21:24:11 +00:00
Antoine Pitrou 211b81dd09 Issue #11114: Fix catastrophic performance of tell() on text files (up
to 1000x faster in some cases).  It is still one to two order of magnitudes
slower than binary tell().
2011-02-25 20:27:33 +00:00
Raymond Hettinger cbb80896ae Issue #10899: Move function type annotations into docstrings.
Note, the docstrings (for the most part) were already very thorough
and included type information.
2011-01-13 18:15:51 +00:00
Georg Brandl 4d73b570eb More PEP 8: no space around "=" in argument lists. 2011-01-13 07:13:06 +00:00
Raymond Hettinger 00fa03900c Issue 10899: Remove function type annotations from the stdlib 2011-01-13 02:52:26 +00:00
Raymond Hettinger d2b03e1409 Backport 87978: Do not expose function type annotations in the standard library. 2011-01-12 23:52:40 +00:00
Raymond Hettinger 3c94024c3e Issue #10899: No function type annotations in the standard library.
Removed function type annotations from _pyio.py.
2011-01-12 23:39:31 +00:00
Antoine Pitrou a4815caa7c Issue #10872: The repr() of TextIOWrapper objects now includes the mode
if available.

(at Georg's request)
2011-01-09 20:38:15 +00:00
Antoine Pitrou 6cfc5124f2 Merged revisions 87427 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/branches/py3k

........
  r87427 | antoine.pitrou | 2010-12-21 22:20:59 +0100 (mar., 21 déc. 2010) | 3 lines

  Issue #10750: The `raw` attribute of buffered IO objects is now read-only.
........
2010-12-21 21:26:09 +00:00
Antoine Pitrou 7f8f41808b Issue #10750: The `raw` attribute of buffered IO objects is now read-only. 2010-12-21 21:20:59 +00:00
Antoine Pitrou 243757eb79 Issue #10180: Pickling file objects is now explicitly forbidden, since
unpickling them produced nonsensical results.
2010-11-05 21:15:39 +00:00
Antoine Pitrou e5e75c64f2 Merged revisions 84814 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/branches/py3k

........
  r84814 | antoine.pitrou | 2010-09-14 20:37:24 +0200 (mar., 14 sept. 2010) | 4 lines

  Issue #9854: The default read() implementation in io.RawIOBase now
  handles non-blocking readinto() returning None correctly.
........
2010-09-14 18:53:07 +00:00
Antoine Pitrou 328ec7455f Issue #9854: The default read() implementation in io.RawIOBase now
handles non-blocking readinto() returning None correctly.
2010-09-14 18:37:24 +00:00
Amaury Forgeot d'Arc 616453c199 More docstring updates 2010-09-06 22:31:52 +00:00
Amaury Forgeot d'Arc ada99488d9 Change docstrings to match the implementation 2010-09-06 22:23:13 +00:00
Antoine Pitrou 972ee13e03 Issue #5506: BytesIO objects now have a getbuffer() method exporting a
view of their contents without duplicating them.  The view is both readable
and writable.
2010-09-06 18:48:21 +00:00
Antoine Pitrou 0d739d7047 Issue #9293: I/O streams now raise `io.UnsupportedOperation` when an
unsupported operation is attempted (for example, writing to a file open
only for reading).
2010-09-05 23:01:12 +00:00
Antoine Pitrou faf9007d86 Merged revisions 80722 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/branches/py3k

................
  r80722 | antoine.pitrou | 2010-05-03 18:48:20 +0200 (lun., 03 mai 2010) | 11 lines

  Merged revisions 80720 via svnmerge from
  svn+ssh://pythondev@svn.python.org/python/trunk

  ........
    r80720 | antoine.pitrou | 2010-05-03 18:25:33 +0200 (lun., 03 mai 2010) | 5 lines

    Issue #7865: The close() method of :mod:`io` objects should not swallow
    exceptions raised by the implicit flush().  Also ensure that calling
    close() several times is supported.  Patch by Pascal Chambon.
  ........
................
2010-05-03 16:58:19 +00:00
Antoine Pitrou 6be8876623 Merged revisions 80720 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk

........
  r80720 | antoine.pitrou | 2010-05-03 18:25:33 +0200 (lun., 03 mai 2010) | 5 lines

  Issue #7865: The close() method of :mod:`io` objects should not swallow
  exceptions raised by the implicit flush().  Also ensure that calling
  close() several times is supported.  Patch by Pascal Chambon.
........
2010-05-03 16:48:20 +00:00
Benjamin Peterson c3be11aac3 Merged revisions 80548-80549 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk

........
  r80548 | benjamin.peterson | 2010-04-27 16:18:30 -0500 (Tue, 27 Apr 2010) | 1 line

  condense import
........
  r80549 | benjamin.peterson | 2010-04-27 16:19:06 -0500 (Tue, 27 Apr 2010) | 1 line

  correct signature
........
2010-04-27 21:24:03 +00:00
Benjamin Peterson 95e392c111 Merged revisions 80544 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk

........
  r80544 | benjamin.peterson | 2010-04-27 16:01:54 -0500 (Tue, 27 Apr 2010) | 1 line

  reject None as the buffering argument like the C implementation does #8546
........
2010-04-27 21:07:21 +00:00
Florent Xicluna b14930cd93 Only the parts which are relevant for 3.x branch.
Merged revisions 78757-78758,78769,78815 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk

........
  r78757 | florent.xicluna | 2010-03-07 13:14:25 +0100 (dim, 07 mar 2010) | 2 lines

  Fix some py3k warnings in the standard library.
........
  r78758 | florent.xicluna | 2010-03-07 13:18:33 +0100 (dim, 07 mar 2010) | 4 lines

  Issue #7849: Now the utility ``check_warnings`` verifies if the warnings are
  effectively raised.  A new utility ``check_py3k_warnings`` deals with py3k warnings.
........
  r78769 | florent.xicluna | 2010-03-07 20:14:12 +0100 (dim, 07 mar 2010) | 2 lines

  Refresh the documentation for the test.test_support module.
........
  r78815 | florent.xicluna | 2010-03-09 20:57:01 +0100 (mar, 09 mar 2010) | 2 lines

  #7772: Fix test_py3kwarn. Now the test suite could pass with "-3" flag.
........
2010-03-13 15:26:44 +00:00
Antoine Pitrou 66f9fea782 Merged revisions 77895-77896 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/branches/py3k

................
  r77895 | antoine.pitrou | 2010-01-31 23:47:27 +0100 (dim., 31 janv. 2010) | 12 lines

  Merged revisions 77890 via svnmerge from
  svn+ssh://pythondev@svn.python.org/python/trunk

  ........
    r77890 | antoine.pitrou | 2010-01-31 23:26:04 +0100 (dim., 31 janv. 2010) | 7 lines

    - Issue #6939: Fix file I/O objects in the `io` module to keep the original
      file position when calling `truncate()`.  It would previously change the
      file position to the given argument, which goes against the tradition of
      ftruncate() and other truncation APIs.  Patch by Pascal Chambon.
  ........
................
  r77896 | antoine.pitrou | 2010-02-01 00:12:29 +0100 (lun., 01 févr. 2010) | 3 lines

  r77895 broke doctest.
................
2010-01-31 23:20:26 +00:00
Antoine Pitrou 905a2ffe3e Merged revisions 77890 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk

........
  r77890 | antoine.pitrou | 2010-01-31 23:26:04 +0100 (dim., 31 janv. 2010) | 7 lines

  - Issue #6939: Fix file I/O objects in the `io` module to keep the original
    file position when calling `truncate()`.  It would previously change the
    file position to the given argument, which goes against the tradition of
    ftruncate() and other truncation APIs.  Patch by Pascal Chambon.
........
2010-01-31 22:47:27 +00:00
Antoine Pitrou 45a437269e Merged revisions 76900 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/branches/py3k

................
  r76900 | antoine.pitrou | 2009-12-19 22:08:31 +0100 (sam., 19 déc. 2009) | 13 lines

  Merged revisions 76896,76898 via svnmerge from
  svn+ssh://pythondev@svn.python.org/python/trunk

  ........
    r76896 | antoine.pitrou | 2009-12-19 22:01:10 +0100 (sam., 19 déc. 2009) | 3 lines

    Issue #7545: improve documentation of the `buffering` argument in io.open().
  ........
    r76898 | antoine.pitrou | 2009-12-19 22:06:36 +0100 (sam., 19 déc. 2009) | 3 lines

    Remove superfetatory paragraph (left there by mistake).
  ........
................
2009-12-19 21:09:58 +00:00
Antoine Pitrou d5587bc474 Merged revisions 76896,76898 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk

........
  r76896 | antoine.pitrou | 2009-12-19 22:01:10 +0100 (sam., 19 déc. 2009) | 3 lines

  Issue #7545: improve documentation of the `buffering` argument in io.open().
........
  r76898 | antoine.pitrou | 2009-12-19 22:06:36 +0100 (sam., 19 déc. 2009) | 3 lines

  Remove superfetatory paragraph (left there by mistake).
........
2009-12-19 21:08:31 +00:00
Georg Brandl 194da4a7da Merged revisions 74126,74130-74131,74149,74155,74157,74180-74183,74398 via svnmerge from
svn+ssh://svn.python.org/python/branches/py3k

................
  r74126 | alexandre.vassalotti | 2009-07-21 02:39:03 +0200 (Di, 21 Jul 2009) | 14 lines

  Merged revisions 73871 via svnmerge from
  svn+ssh://pythondev@svn.python.org/python/trunk

  ........
    r73871 | alexandre.vassalotti | 2009-07-06 22:17:30 -0400 (Mon, 06 Jul 2009) | 7 lines

    Grow the allocated buffer in PyUnicode_EncodeUTF7 to avoid buffer overrun.

    Without this change, test_unicode.UnicodeTest.test_codecs_utf7 crashes in
    debug mode. What happens is the unicode string u'\U000abcde' with a length
    of 1 encodes to the string '+2m/c3g-' of length 8. Since only 5 bytes is
    reserved in the buffer, a buffer overrun occurs.
  ........
................
  r74130 | alexandre.vassalotti | 2009-07-21 02:57:50 +0200 (Di, 21 Jul 2009) | 2 lines

  Add ignore rule for the Doc/tools/jinga2/ directory.
................
  r74131 | alexandre.vassalotti | 2009-07-21 04:51:58 +0200 (Di, 21 Jul 2009) | 13 lines

  Merged revisions 73683,73786 via svnmerge from
  svn+ssh://pythondev@svn.python.org/python/trunk

  ........
    r73683 | georg.brandl | 2009-06-29 10:44:49 -0400 (Mon, 29 Jun 2009) | 1 line

    Fix error handling in PyCode_Optimize, by Alexander Schremmer at EuroPython sprint.
  ........
    r73786 | benjamin.peterson | 2009-07-02 18:56:16 -0400 (Thu, 02 Jul 2009) | 1 line

    condense with assertRaises
  ........
................
  r74149 | ezio.melotti | 2009-07-21 22:37:52 +0200 (Di, 21 Jul 2009) | 9 lines

  Merged revisions 74148 via svnmerge from
  svn+ssh://pythondev@svn.python.org/python/trunk

  ........
    r74148 | ezio.melotti | 2009-07-21 23:18:27 +0300 (Tue, 21 Jul 2009) | 1 line

    #6536 fixed typo
  ........
................
  r74155 | alexandre.vassalotti | 2009-07-22 04:24:49 +0200 (Mi, 22 Jul 2009) | 2 lines

  Issue #6242: Fix deallocator of io.StringIO and io.BytesIO.
................
  r74157 | alexandre.vassalotti | 2009-07-22 05:07:33 +0200 (Mi, 22 Jul 2009) | 2 lines

  Issue #6241: Better type checking for the arguments of io.StringIO.
................
  r74180 | ezio.melotti | 2009-07-22 23:17:14 +0200 (Mi, 22 Jul 2009) | 9 lines

  Merged revisions 74179 via svnmerge from
  svn+ssh://pythondev@svn.python.org/python/trunk

  ........
    r74179 | ezio.melotti | 2009-07-23 00:08:49 +0300 (Thu, 23 Jul 2009) | 1 line

    #6423 has_key -> in
  ........
................
  r74181 | alexandre.vassalotti | 2009-07-22 23:27:53 +0200 (Mi, 22 Jul 2009) | 6 lines

  Clean up test_curses.

  By using __stdout__ directly, test_curses caused regrtest.py
  to duplicate the output of some test results.
................
  r74182 | alexandre.vassalotti | 2009-07-22 23:29:01 +0200 (Mi, 22 Jul 2009) | 2 lines

  Use assertGreater instead of assertTrue(x > y).
................
  r74183 | alexandre.vassalotti | 2009-07-23 01:27:17 +0200 (Do, 23 Jul 2009) | 4 lines

  Specialize assertTrue checks when possible.

  We should get slightly more helpful failure messages with this change.
................
  r74398 | georg.brandl | 2009-08-13 11:16:39 +0200 (Do, 13 Aug 2009) | 1 line

  #6694: fix old function names.
................
2009-08-13 09:34:05 +00:00
Alexandre Vassalotti cf76e1ac92 Issue #6218: Make io.BytesIO and io.StringIO picklable. 2009-07-22 03:24:36 +00:00
Alexandre Vassalotti d2bb18b281 Issue #6241: Better type checking for the arguments of io.StringIO. 2009-07-22 03:07:33 +00:00
Benjamin Peterson 0926ad1f05 give the C implementation of TextIOWrapper the errors property #6217 2009-06-06 18:02:12 +00:00
Antoine Pitrou 716c444edc Issue #5761: Add the name of the underlying file to the repr() of various IO objects. 2009-05-23 19:04:03 +00:00
Antoine Pitrou e450185b4a Issue #5006: Better handling of unicode byte-order marks (BOM) in the io library.
This means, for example, that opening an UTF-16 text file in
append mode doesn't add a BOM at the end of the file if the file isn't
empty.
2009-05-14 18:55:55 +00:00
Benjamin Peterson d2e0c7955f implement a detach() method for BufferedIOBase and TextIOBase #5883 2009-05-01 20:40:59 +00:00
Benjamin Peterson b01138a66e readline() args must be an int #3521 2009-04-24 22:59:52 +00:00
Antoine Pitrou cf4c749680 Issue #5734: BufferedRWPair was poorly tested and had several glaring bugs.
Patch by Brian Quinlan.
2009-04-19 00:09:36 +00:00
Benjamin Peterson 9990e8c264 add annotations to open() 2009-04-18 14:47:50 +00:00