summaryrefslogtreecommitdiffstats
path: root/Modules/_io
Commit message (Collapse)AuthorAgeFilesLines
* 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-254-64/+37
| | | | | (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-165-63/+105
| | | | _io module. (#3726)
* closes bpo-32460: ensure all non-static globals have initializers (#5061)Benjamin Peterson2017-12-311-27/+27
|
* bpo-32402: io: Add missing NULL check. (GH-4971)INADA Naoki2017-12-241-0/+6
| | | | | _PyUnicode_FromId() may return NULL. Reported by coverity scan: CID 1426868, 1426867.
* bpo-15216: io: TextIOWrapper.reconfigure() accepts encoding, errors and ↵INADA Naoki2017-12-212-150/+329
| | | | newline (GH-2343)
* bpo-32240: Add the const qualifier to declarations of PyObject* array ↵Serhiy Storchaka2017-12-158-38/+38
| | | | arguments. (#4746)
* bpo-17852: Revert incorrect fix based on misunderstanding of _Py_PyAtExit() ↵Antoine Pitrou2017-12-133-54/+1
| | | | semantics (#4826)
* bpo-32186: Release the GIL during lseek and fstat (#4652)Nir Soffer2017-12-011-1/+5
| | | | | | In _io_FileIO_readall_impl(), lseek() and _Py_fstat_noraise() were called without releasing the GIL. This can cause all threads to hang for unlimited time when calling FileIO.read() and the NFS server is not accessible.
* bpo-31976: Fix race condition when flushing a file is slow. (#4331)benfogle2017-11-101-5/+9
|
* Replace KB unit with KiB (#4293)Victor Stinner2017-11-082-2/+2
| | | | | | | | | | | kB (*kilo* byte) unit means 1000 bytes, whereas KiB ("kibibyte") means 1024 bytes. KB was misused: replace kB or KB with KiB when appropriate. Same change for MB and GB which become MiB and GiB. Change the output of Tools/iobench/iobench.py. Round also the size of the documentation from 5.5 MB to 5 MiB.
* bpo-25359: Add missed "goto error" after setting an exception. (#3712)Serhiy Storchaka2017-09-231-0/+1
|
* bpo-17852: Maintain a list of BufferedWriter objects. Flush them on exit. ↵Neil Schemenauer2017-09-223-1/+54
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | (#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-081-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-061-1/+1
| | | Windows buildbots started failing due to include-related errors.
* bpo-30860: Consolidate stateful runtime globals. (#2594)Eric Snow2017-09-061-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-053-49/+1
| | | | | exit. (#1908)" (#3337) This reverts commit e38d12ed34870c140016bef1e0ff10c8c3d3f213.
* bpo-17852: Maintain a list of BufferedWriter objects. Flush them on exit. ↵Neil Schemenauer2017-09-053-1/+49
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | (#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-31243: Fixed PyArg_ParseTuple failure checks. (#3171)Oren Milman2017-08-291-5/+13
|
* bpo-31271: Fix an assertion failure in io.TextIOWrapper.write. (#3201)Oren Milman2017-08-251-0/+7
|
* bpo-28261: fix err msgs where PyArg_ParseTuple is used to parse normal ↵Oren Milman2017-08-241-3/+20
| | | | tuples (leftovers) (#3198)
* bpo-31095: fix potential crash during GC (GH-2974)INADA Naoki2017-08-241-0/+2
|
* bpo-28261: Fixed err msgs where PyArg_ParseTuple is used to parse normal ↵Oren Milman2017-08-201-1/+8
| | | | tuples. (#3119)
* bpo-29464: Rename METH_FASTCALL to METH_FASTCALL|METH_KEYWORDS and make (#1955)Serhiy Storchaka2017-07-038-146/+38
| | | | | the bare METH_FASTCALL be used for functions with positional-only parameters.
* [security] bpo-13617: Reject embedded null characters in wchar* strings. (#2302)Serhiy Storchaka2017-06-281-2/+1
| | | | | | | Based on patch by Victor Stinner. Add private C API function _PyUnicode_AsUnicode() which is similar to PyUnicode_AsUnicode(), but checks for null characters.
* bpo-30708: Check for null characters in PyUnicode_AsWideCharString(). (#2285)Serhiy Storchaka2017-06-271-8/+1
| | | | | Raise a ValueError if the second argument is NULL and the wchar_t\* string contains null characters.
* bpo-30600: Fix error messages (condition order in Argument Clinic) (#2051)Sylvain2017-06-107-92/+92
| | | | | | | | The function '_PyArg_ParseStack()' and '_PyArg_UnpackStack' were failing (with error "XXX() takes Y argument (Z given)") before the function '_PyArg_NoStackKeywords()' was called. Thus, the latter did not raise its more meaningful error : "XXX() takes no keyword arguments".
* bpo-30601: Fix a refleak in WindowsConsoleIO (#2003)Victor Stinner2017-06-081-3/+2
| | | | | Fix a reference leak in _io._WindowsConsoleIO: PyUnicode_FSDecoder() always initialize decodedname when it succeed and it doesn't clear input decodedname object.
* Fix bpo-30526: Add TextIOWrapper.reconfigure() and a ↵Antoine Pitrou2017-06-032-1/+96
| | | | | | | | | | TextIOWrapper.write_through attribute (#1922) * Fix bpo-30526: Add TextIOWrapper.reconfigure() * Apply Nick's improved wording * Update Misc/NEWS
* bpo-30544: _io._WindowsConsoleIO.write raises the wrong error when ↵Segev Finer2017-06-021-1/+1
| | | | | | | | WriteConsoleW fails (#1912) * bpo-30544: _io._WindowsConsoleIO.write raises the wrong error when WriteConsoleW fails * bpo-30544: _io._WindowsConsoleIO.write raises the wrong error when WriteConsoleW fails
* bpo-30228: FileIO seek() and tell() set seekable (#1384)Victor Stinner2017-05-021-15/+21
| | | | | | | FileIO.seek() and FileIO.tell() method now set the internal seekable attribute to avoid one syscall on open() (in buffered or text mode). The seekable property is now also more reliable since its value is set correctly on memory allocation failure.
* bpo-30061: Check if PyObject_Size()/PySequence_Size()/PyMapping_Size() (#1096)Serhiy Storchaka2017-04-191-4/+9
| | | | | | raised an error. Replace them with using concrete types API that never fails if appropriate.
* bpo-30022: Get rid of using EnvironmentError and IOError (except test… (#1051)Serhiy Storchaka2017-04-168-29/+29
|
* bpo-30068: add missing iter(self) in _io._IOBase.readlines when hint is ↵Xiang Zhang2017-04-151-8/+17
| | | | present (#1130)
* bpo-29852: Argument Clinic Py_ssize_t converter now supports None (#716)Serhiy Storchaka2017-03-3016-174/+59
| | | if pass `accept={int, NoneType}`.
* bpo-29878: Add global instances of int for 0 and 1. (#852)Serhiy Storchaka2017-03-303-12/+7
|
* 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-214-4/+4
| | | | (#748)
* bpo-25455: Fixed crashes in repr of recursive buffered file-like objects. (#514)Serhiy Storchaka2017-03-193-8/+45
|
* bpo-29730: replace some calls to PyNumber_Check and improve some error ↵Oren Milman2017-03-123-7/+16
| | | | messages (#650)
* bpo-24037: Add Argument Clinic converter `bool(accept={int})`. (#485)Serhiy Storchaka2017-03-124-11/+11
|
* bpo-29741: Clean up C implementations of BytesIO and StringIO. (#606)orenmn2017-03-104-120/+68
| | | Some BytesIO methods now accept not just int subclasses but other int-like types.
* Merge from 3.6Steve Dower2017-02-051-1/+13
|\
| * Adds precheck for console filename to fix Windows 7.Steve Dower2017-02-051-1/+13
| |
* | Merge issue #28164 and issue #29409Steve Dower2017-02-042-37/+51
|\ \ | |/
| * Issue #28164: Correctly handle special console filenames (patch by Eryk Sun)Steve Dower2017-02-041-20/+47
| |
| * Issue #29409: Implement PEP 529 for io.FileIO (Patch by Eryk Sun)Steve Dower2017-02-041-17/+14
| |
* | 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.
* | Run Argument Clinic: METH_VARARGS=>METH_FASTCALLVictor Stinner2017-01-175-38/+82
| | | | | | | | | | | | | | | | Issue #29286. Run Argument Clinic to get the new faster METH_FASTCALL calling convention for functions using "boring" positional arguments. Manually fix _elementtree: _elementtree_XMLParser_doctype() must remain consistent with the clinic code.