summaryrefslogtreecommitdiffstats
path: root/Lib/_pyio.py
Commit message (Collapse)AuthorAgeFilesLines
* bpo-18748: Fix _pyio.IOBase destructor (closed case) (GH-13952)Victor Stinner2019-06-111-0/+10
| | | | _pyio.IOBase destructor now does nothing if getting the closed attribute fails to better mimick _io.IOBase finalizer.
* bpo-37054, _pyio: Fix BytesIO and TextIOWrapper __del__() (GH-13601)Victor Stinner2019-05-271-1/+10
| | | | | Fix destructor _pyio.BytesIO and _pyio.TextIOWrapper: initialize their _buffer attribute as soon as possible (in the class body), because it's used by __del__() which calls close().
* bpo-36842: Implement PEP 578 (GH-12613)Steve Dower2019-05-231-0/+23
| | | Adds sys.audit, sys.addaudithook, io.open_code, and associated C APIs.
* bpo-18748: _pyio.IOBase emits unraisable exception (GH-13512)Victor Stinner2019-05-231-8/+15
| | | | | | | | In development (-X dev) mode and in a debug build, IOBase finalizer of the _pyio module now logs the exception if the close() method fails. The exception is ignored silently by default in release build. test_io: test_error_through_destructor() now uses support.catch_unraisable_exception() rather than capturing stderr.
* bpo-36523: Add docstring to io.IOBase.writelines (GH-12683)Marcin Niemira2019-04-221-0/+5
|
* closes bpo-35848: Move all documentation regarding the readinto out of ↵Steve Palmer2019-04-091-6/+4
| | | | | | | IOBase. (GH-11893) Move all documentation regarding the readinto method into either io.RawIOBase or io.BufferedIOBase. Corresponding changes to documentation in the _pyio.py module.
* Use names SEEK_SET, etc instead of magic number (GH-12057)ngie-eign2019-03-031-3/+3
| | | | | | | The previous code hardcoded `SEEK_SET`, etc. While it's very unlikely that these values will change, it's best to use the definitions to avoid there being mismatches in behavior with the code in the future. Signed-off-by: Enji Cooper <yaneurabeya@gmail.com>
* bpo-33138: Change standard error message for non-pickleable and non-copyable ↵Serhiy Storchaka2018-10-311-3/+2
| | | | types. (GH-6239)
* bpo-32236: open() emits RuntimeWarning if buffering=1 for binary mode (GH-4842)Alexey Izbyshev2018-10-201-0/+5
| | | | | | | | | If buffering=1 is specified for open() in binary mode, it is silently treated as buffering=-1 (i.e., the default buffer size). Coupled with the fact that line buffering is always supported in Python 2, such behavior caused several issues (e.g., bpo-10344, bpo-21332). Warn that line buffering is not supported if open() is called with binary mode and buffering=1.
* Remove wording that could be deemed to be perjorative (GH-9287)Raymond Hettinger2018-09-141-1/+1
|
* bpo-25862: Fix assertion failures in io.TextIOWrapper.tell(). (GH-3918)Zackery Spytz2018-06-291-0/+1
|
* bpo-15216: io: TextIOWrapper.reconfigure() accepts encoding, errors and ↵INADA Naoki2017-12-211-20/+56
| | | | newline (GH-2343)
* bpo-17852: Revert incorrect fix based on misunderstanding of _Py_PyAtExit() ↵Antoine Pitrou2017-12-131-24/+0
| | | | semantics (#4826)
* bpo-31976: Fix race condition when flushing a file is slow. (#4331)benfogle2017-11-101-2/+17
|
* bpo-17852: Maintain a list of BufferedWriter objects. Flush them on exit. ↵Neil Schemenauer2017-09-221-0/+24
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | (#3372) * Maintain a list of BufferedWriter objects. Flush them on exit. In Python 3, the buffer and the underlying file object are separate and so the order in which objects are finalized matters. This is unlike Python 2 where the file and buffer were a single object and finalization was done for both at the same time. In Python 3, if the file is finalized and closed before the buffer then the data in the buffer is lost. This change adds a doubly linked list of open file buffers. An atexit hook ensures they are flushed before proceeding with interpreter shutdown. This is addition does not remove the need to properly close files as there are other reasons why buffered data could get lost during finalization. Initial patch by Armin Rigo. * Use weakref.WeakSet instead of WeakKeyDictionary. * Simplify buffered double-linked list types. * In _flush_all_writers(), suppress errors from flush(). * Remove NEWS entry, use blurb. * Take more care when flushing file buffers from atexit. The previous implementation was not careful enough to avoid causing issues in multi-threaded cases. Check for buf->ok and buf->finalizing before actually doing the flush. Also, increase the refcnt to ensure the object does not disappear.
* bpo-31370: Remove support for threads-less builds (#3385)Antoine Pitrou2017-09-071-4/+1
| | | | | | * Remove Setup.config * Always define WITH_THREAD for compatibility.
* Revert "bpo-17852: Maintain a list of BufferedWriter objects. Flush them on ↵Neil Schemenauer2017-09-051-24/+0
| | | | | exit. (#1908)" (#3337) This reverts commit e38d12ed34870c140016bef1e0ff10c8c3d3f213.
* bpo-17852: Maintain a list of BufferedWriter objects. Flush them on exit. ↵Neil Schemenauer2017-09-051-0/+24
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | (#1908) * Maintain a list of BufferedWriter objects. Flush them on exit. In Python 3, the buffer and the underlying file object are separate and so the order in which objects are finalized matters. This is unlike Python 2 where the file and buffer were a single object and finalization was done for both at the same time. In Python 3, if the file is finalized and closed before the buffer then the data in the buffer is lost. This change adds a doubly linked list of open file buffers. An atexit hook ensures they are flushed before proceeding with interpreter shutdown. This is addition does not remove the need to properly close files as there are other reasons why buffered data could get lost during finalization. Initial patch by Armin Rigo. * Use weakref.WeakSet instead of WeakKeyDictionary. * Simplify buffered double-linked list types. * In _flush_all_writers(), suppress errors from flush(). * Remove NEWS entry, use blurb.
* bpo-29741: Update some methods in the _pyio module to also accept integer ↵Oren Milman2017-08-241-14/+38
| | | | types. Patch by Oren Milman. (#560)
* Fix bpo-30526: Add TextIOWrapper.reconfigure() and a ↵Antoine Pitrou2017-06-031-1/+22
| | | | | | | | | | TextIOWrapper.write_through attribute (#1922) * Fix bpo-30526: Add TextIOWrapper.reconfigure() * Apply Nick's improved wording * Update Misc/NEWS
* Fix small exception typos in Lib (#818)Jim Fasarakis-Hilliard2017-03-261-2/+2
|
* Merge from 3.6.Serhiy Storchaka2016-12-071-1/+1
|\
| * Merge from 3.5.Serhiy Storchaka2016-12-071-1/+1
| |\
| | * Change order of io.UnsupportedOperation base classes.Serhiy Storchaka2016-12-071-1/+1
| | | | | | | | | | | | This makes tests passing after changes by issue #5322.
* | | Issue #23214: Implement optional BufferedReader, BytesIO read1() argumentMartin Panter2016-10-201-9/+9
|/ /
* | Drop unused importMartin Panter2016-06-121-1/+0
| |
* | issue27186: add open/io.open; patch by Jelle ZijlstraEthan Furman2016-06-041-0/+2
| |
* | Issue #27171: Merge typo fixes from 3.5Martin Panter2016-06-021-1/+1
|\ \ | |/
| * Issue #27171: Fix typos in documentation, comments, and test function namesMartin Panter2016-06-021-1/+1
| |
* | Issue #20699: Merge io bytes-like fixes from 3.5Martin Panter2016-05-281-12/+14
|\ \ | |/
| * Issue #20699: Document that “io” methods accept bytes-like objectsMartin Panter2016-05-281-12/+14
| | | | | | | | | | | | | | | | This matches the usage of ZipFile and BufferedWriter. This still requires return values to be bytes() objects. Also document and test that the write() methods should only access their argument before they return.
* | Issue #26778: Fixed "a/an/and" typos in code comment, documentation and errorSerhiy Storchaka2016-04-171-1/+1
|\ \ | |/ | | | | messages.
| * Issue #26778: Fixed "a/an/and" typos in code comment and documentation.Serhiy Storchaka2016-04-171-1/+1
| |
* | Issue #22854: Merge UnsupportedOperation fixes from 3.5Martin Panter2016-03-311-9/+9
|\ \ | |/
| * Issue #22854: Clarify documentation about UnsupportedOperation and add testsMartin Panter2016-03-311-9/+9
| | | | | | | | | | Also change BufferedReader.writable() and BufferedWriter.readable() to always return False.
* | Add a source parameter to warnings.warn()Victor Stinner2016-03-221-1/+1
| | | | | | | | | | | | | | | | Issue #26604: * Add a new optional source parameter to _warnings.warn() and warnings.warn() * Modify asyncore, asyncio and _pyio modules to set the source parameter when logging a ResourceWarning warning
* | Issue #25523: Merge a-to-an corrections from 3.5Martin Panter2015-11-021-1/+1
|\ \ | |/
| * Issue #25523: Merge "a" to "an" fixes from 3.4 into 3.5Martin Panter2015-11-021-1/+1
| |\
| | * Issue #25523: Correct "a" article to "an" articleMartin Panter2015-11-021-1/+1
| | | | | | | | | | | | | | | | | | This changes the main documentation, doc strings, source code comments, and a couple error messages in the test suite. In some cases the word was removed or edited some other way to fix the grammar.
* | | Issue #24881: Fixed setting binary mode in Python implementation of FileIOSerhiy Storchaka2015-08-281-1/+2
|\ \ \ | |/ / | | | | | | on Windows and Cygwin. Patch from Akira Li.
| * | Issue #24881: Fixed setting binary mode in Python implementation of FileIOSerhiy Storchaka2015-08-281-1/+2
| | | | | | | | | | | | on Windows and Cygwin. Patch from Akira Li.
* | | - Issue #2091: error correctly on open() with mode 'U' and '+'Robert Collins2015-07-251-2/+2
|/ / | | | | | | | | open() accepted a 'U' mode string containing '+', but 'U' can only be used with 'r'. Patch from Jeff Balogh and John O'Connor.
* | Issue #22982: Improve BOM handling when seeking to multiple positions of a ↵Antoine Pitrou2015-04-131-11/+15
|\ \ | |/ | | | | writable text file.
| * Issue #22982: Improve BOM handling when seeking to multiple positions of a ↵Antoine Pitrou2015-04-131-11/+15
| | | | | | | | writable text file.
* | Issue #21859: Added Python implementation of io.FileIO.Serhiy Storchaka2015-04-101-0/+344
| |
* | Issue #21802: The reader in BufferedRWPair now is closed even when closingSerhiy Storchaka2015-03-241-2/+4
|\ \ | |/ | | | | writer failed in BufferedRWPair.close().
| * Issue #21802: The reader in BufferedRWPair now is closed even when closingSerhiy Storchaka2015-03-241-2/+4
| | | | | | | | writer failed in BufferedRWPair.close().
* | merge 3.4Benjamin Peterson2015-03-191-2/+2
|\ \ | |/
| * wrap properlyBenjamin Peterson2015-03-191-2/+2
| |
* | Issue #23285: PEP 475 -- Retry system calls failing with EINTR.Charles-François Natali2015-02-071-16/+3
| |