summaryrefslogtreecommitdiff
path: root/Modules/_io/bufferedio.c
Commit message (Collapse)AuthorAgeFilesLines
* bpo-35081: Add Include/internal/pycore_object.h (GH-10640)Victor Stinner2018-11-211-0/+1
| | | | Move _PyObject_GC_TRACK() and _PyObject_GC_UNTRACK() from Include/objimpl.h to Include/internal/pycore_object.h.
* bpo-35081: Rename internal headers (GH-10275)Victor Stinner2018-11-121-1/+1
| | | | | | | | | | | | | | Rename Include/internal/ headers: * pycore_hash.h -> pycore_pyhash.h * pycore_lifecycle.h -> pycore_pylifecycle.h * pycore_mem.h -> pycore_pymem.h * pycore_state.h -> pycore_pystate.h Add missing headers to Makefile.pre.in and PCbuild: * pycore_condvar.h. * pycore_hamt.h * pycore_pyhash.h
* bpo-35081: Add pycore_ prefix to internal header files (GH-10263)Victor Stinner2018-11-011-1/+1
| | | | | | | | | | | | | | | | | | | | * Rename Include/internal/ header files: * pyatomic.h -> pycore_atomic.h * ceval.h -> pycore_ceval.h * condvar.h -> pycore_condvar.h * context.h -> pycore_context.h * pygetopt.h -> pycore_getopt.h * gil.h -> pycore_gil.h * hamt.h -> pycore_hamt.h * hash.h -> pycore_hash.h * mem.h -> pycore_mem.h * pystate.h -> pycore_state.h * warnings.h -> pycore_warnings.h * PCbuild project, Makefile.pre.in, Modules/Setup: add the Include/internal/ directory to the search paths of header files. * Update includes. For example, replace #include "internal/mem.h" with #include "pycore_mem.h".
* bpo-33138: Change standard error message for non-pickleable and non-copyable ↵Serhiy Storchaka2018-10-311-15/+0
| | | | types. (GH-6239)
* bpo-34287: Do not use second argument of METH_NOARGS functions (GH-8582)jdemeyer2018-08-021-21/+21
|
* bpo-32228: Reset raw_pos after unwinding the raw stream (#4858)Nitish Chandra2018-01-281-4/+10
| | | Ensure that ``truncate()`` preserves the file position (as reported by ``tell()``) after writes longer than the buffer size.
* bpo-32571: Avoid raising unneeded AttributeError and silencing it in C code ↵Serhiy Storchaka2018-01-251-4/+3
| | | | | (GH-5222) Add two new private APIs: _PyObject_LookupAttr() and _PyObject_LookupAttrId()
* bpo-31572: Get rid of PyObject_HasAttr() and _PyObject_HasAttrId() in the ↵Serhiy Storchaka2018-01-161-18/+14
| | | | _io module. (#3726)
* bpo-17852: Revert incorrect fix based on misunderstanding of _Py_PyAtExit() ↵Antoine Pitrou2017-12-131-50/+1
| | | | semantics (#4826)
* bpo-31976: Fix race condition when flushing a file is slow. (#4331)benfogle2017-11-101-5/+9
|
* bpo-17852: Maintain a list of BufferedWriter objects. Flush them on exit. ↵Neil Schemenauer2017-09-221-1/+50
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | (#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-30860: Consolidate stateful runtime globals. (#3397)Eric Snow2017-09-071-1/+2
| | | | | | | * group the (stateful) runtime globals into various topical structs * consolidate the topical structs under a single top-level _PyRuntimeState struct * add a check-c-globals.py script that helps identify runtime globals Other globals are excluded (see globals.txt and check-c-globals.py).
* bpo-31370: Remove support for threads-less builds (#3385)Antoine Pitrou2017-09-071-13/+0
| | | | | | * Remove Setup.config * Always define WITH_THREAD for compatibility.
* Revert "bpo-30860: Consolidate stateful runtime globals." (#3379)Eric Snow2017-09-051-1/+1
| | | Windows buildbots started failing due to include-related errors.
* bpo-30860: Consolidate stateful runtime globals. (#2594)Eric Snow2017-09-051-1/+1
| | | | | | | | | * group the (stateful) runtime globals into various topical structs * consolidate the topical structs under a single top-level _PyRuntimeState struct * add a check-c-globals.py script that helps identify runtime globals Other globals are excluded (see globals.txt and check-c-globals.py).
* Revert "bpo-17852: Maintain a list of BufferedWriter objects. Flush them on ↵Neil Schemenauer2017-09-041-45/+1
| | | | | exit. (#1908)" (#3337) This reverts commit e38d12ed34870c140016bef1e0ff10c8c3d3f213.
* bpo-17852: Maintain a list of BufferedWriter objects. Flush them on exit. ↵Neil Schemenauer2017-09-041-1/+45
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | (#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-30022: Get rid of using EnvironmentError and IOError (except test… (#1051)Serhiy Storchaka2017-04-161-9/+9
|
* bpo-29852: Argument Clinic Py_ssize_t converter now supports None (#716)Serhiy Storchaka2017-03-301-11/+4
| | | if pass `accept={int, NoneType}`.
* bpo-6532: Make the thread id an unsigned integer. (#781)Serhiy Storchaka2017-03-231-1/+1
| | | | | | | | | | | * bpo-6532: Make the thread id an unsigned integer. From C API side the type of results of PyThread_start_new_thread() and PyThread_get_thread_ident(), the id parameter of PyThreadState_SetAsyncExc(), and the thread_id field of PyThreadState changed from "long" to "unsigned long". * Restore a check in thread_get_ident().
* bpo-29865: Use PyXXX_GET_SIZE macros rather than Py_SIZE for concrete types. ↵Serhiy Storchaka2017-03-211-1/+1
| | | | (#748)
* bpo-25455: Fixed crashes in repr of recursive buffered file-like objects. (#514)Serhiy Storchaka2017-03-191-2/+12
|
* Issue #28999: Use Py_RETURN_NONE, Py_RETURN_TRUE and Py_RETURN_FALSE whereverSerhiy Storchaka2017-01-231-4/+2
| | | | possible. Patch is writen with Coccinelle.
* Use _PyObject_CallMethodIdObjArgs() in _ioVictor Stinner2016-12-091-1/+2
| | | | | | | | | Issue #28915: Replace _PyObject_CallMethodId() with _PyObject_CallMethodIdObjArgs() when the format string was only made of "O" formats, PyObject* arguments. _PyObject_CallMethodIdObjArgs() avoids the creation of a temporary tuple and doesn't have to parse a format string.
* Added the const qualifier to char* variables that refer to readonly internalSerhiy Storchaka2016-11-201-1/+1
| | | | UTF-8 represenatation of Unicode objects.
* Issue #23214: Implement optional BufferedReader, BytesIO read1() argumentMartin Panter2016-10-201-6/+4
|
* Issue #20699: Merge io bytes-like fixes from 3.5Martin Panter2016-05-281-2/+2
|\
| * Issue #20699: Document that “io” methods accept bytes-like objectsMartin Panter2016-05-281-2/+2
| | | | | | | | | | | | | | | | 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 #22570: Renamed Py_SETREF to Py_XSETREF.Serhiy Storchaka2016-04-061-4/+4
|\ \ | |/
| * Issue #22570: Renamed Py_SETREF to Py_XSETREF.Serhiy Storchaka2016-04-061-4/+4
| |
* | Issue #22854: Merge UnsupportedOperation fixes from 3.5Martin Panter2016-03-311-2/+0
|\ \ | |/
| * Issue #22854: Clarify documentation about UnsupportedOperation and add testsMartin Panter2016-03-311-2/+0
| | | | | | | | | | Also change BufferedReader.writable() and BufferedWriter.readable() to always return False.
* | Issue #20440: Applied yet one patch for using Py_SETREF.Serhiy Storchaka2015-12-271-8/+4
|\ \ | |/ | | | | The patch is automatically generated, it replaces the code that uses Py_CLEAR.
| * Issue #20440: Applied yet one patch for using Py_SETREF.Serhiy Storchaka2015-12-271-8/+4
| | | | | | | | The patch is automatically generated, it replaces the code that uses Py_CLEAR.
* | Issue #25923: Added more const qualifiers to signatures of static and ↵Serhiy Storchaka2015-12-251-1/+1
|/ | | | private functions.
* Issue #25421: __sizeof__ methods of builtin types now use dynamic basic size.Serhiy Storchaka2015-12-191-1/+1
| | | | | This allows sys.getsize() to work correctly with their subclasses with __slots__ defined.
* Fixes cast warning in bufferedio.cSteve Dower2015-05-231-1/+1
|
* Issue #23796: peak and read1 methods of BufferedReader now raise ValueErrorBerker Peksag2015-05-121-0/+5
| | | | | | if they called on a closed object. Patch by John Hergenroeder.
* Issue #24001: Argument Clinic converters now use accept={type}Larry Hastings2015-05-041-8/+8
| | | | instead of types={'type'} to specify the types the converter accepts.
* Issue #20175: Converted the _io module to Argument Clinic.Serhiy Storchaka2015-04-161-475/+518
|
* Issue #23309: Avoid a deadlock at shutdown if a daemon thread is abortedAntoine Pitrou2015-04-131-1/+22
|\ | | | | | | | | | | while it is holding a lock to a buffered I/O object, and the main thread tries to use the same I/O object (typically stdout or stderr). A fatal error is emitted instead.
| * Issue #23309: Avoid a deadlock at shutdown if a daemon thread is abortedAntoine Pitrou2015-04-131-1/+22
| | | | | | | | | | | | while it is holding a lock to a buffered I/O object, and the main thread tries to use the same I/O object (typically stdout or stderr). A fatal error is emitted instead.
* | Issue #21802: The reader in BufferedRWPair now is closed even when closingSerhiy Storchaka2015-03-241-4/+10
|\ \ | |/ | | | | writer failed in BufferedRWPair.close().
| * Issue #21802: The reader in BufferedRWPair now is closed even when closingSerhiy Storchaka2015-03-241-4/+10
| | | | | | | | writer failed in BufferedRWPair.close().
* | Removed unintentional trailing spaces in non-external and non-generated C files.Serhiy Storchaka2015-03-181-2/+2
| |
* | Issue #23571: PyObject_Call(), PyCFunction_Call() and call_function() nowVictor Stinner2015-03-061-4/+0
| | | | | | | | | | | | | | | | | | | | | | raise a SystemError if a function returns a result and raises an exception. The SystemError is chained to the previous exception. Refactor also PyObject_Call() and PyCFunction_Call() to make them more readable. Remove some checks which became useless (duplicate checks). Change reviewed by Serhiy Storchaka.
* | merge 3.4 (#23093)Benjamin Peterson2014-12-211-1/+1
|\ \ | |/
| * allow more operations to work on detached streams (closes #23093)Benjamin Peterson2014-12-211-1/+1
| | | | | | | | Patch by Martin Panter.
* | Issue #21715: Extracted shared complicated code in the _io module to newSerhiy Storchaka2014-10-081-14/+2
|\ \ | |/ | | | | _PyErr_ChainExceptions() function.
| * Issue #21715: Extracted shared complicated code in the _io module to newSerhiy Storchaka2014-10-081-14/+2
| | | | | | | | _PyErr_ChainExceptions() function.