Commit Graph

326 Commits

Author SHA1 Message Date
Steve Dower 8acde7dcce Issue #23524: Change back to using Windows errors for _Py_fstat instead of the errno shim. 2015-03-07 18:14:07 -08:00
Victor Stinner 4a7cc88472 Issue #23571: PyObject_Call(), PyCFunction_Call() and call_function() now
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.
2015-03-06 23:35:27 +01:00
Steve Dower d81431f587 Issue #23524: Replace _PyVerify_fd function with calling _set_thread_local_invalid_parameter_handler on every thread. 2015-03-06 14:47:02 -08:00
Victor Stinner 9672da7bb4 Issue #23285: Fix handling of EINTR in fileio.c
Fix handling of EINTR: don't return None if PyErr_CheckSignals() raised an
exception.

Initialize also the length outside the loop to only initialize it once.
2015-03-04 18:40:10 +01:00
Steve Dower f2f373f593 Issue #23152: Implement _Py_fstat() to support files larger than 2 GB on Windows.
fstat() may fail with EOVERFLOW on files larger than 2 GB because the file size type is an signed 32-bit integer.
2015-02-21 08:44:05 -08:00
Serhiy Storchaka 254dd59068 Issue #5700: io.FileIO() called flush() after closing the file.
flush() was not called in close() if closefd=False.
2015-02-21 00:35:53 +02:00
Serhiy Storchaka a3712a9a6c Issue #5700: io.FileIO() called flush() after closing the file.
flush() was not called in close() if closefd=False.
2015-02-21 00:35:09 +02:00
Serhiy Storchaka 483405bcca Issue #22883: Got rid of outdated references to PyInt and PyString in comments. 2015-02-17 10:14:30 +02:00
Charles-François Natali 6e6c59b508 Issue #23285: PEP 475 -- Retry system calls failing with EINTR. 2015-02-07 13:27:50 +00:00
Stefan Krah 650c1e818d Issue #14203: Remove obsolete support for view==NULL in bytesiobuf_getbuffer()
and array_buffer_getbuf().
2015-02-03 21:43:23 +01:00
Serhiy Storchaka 38c30e6c8e Issue #15381: Fixed a bug in BytesIO.write().
It was expected that string_size == PyBytes_GET_SIZE(buf) if the buffer is
shared, but truncate() and __setstate__() can set string_size without
unsharing the buffer.
2015-02-03 18:51:58 +02:00
Serhiy Storchaka b9765eec5c Issue #15381: Try to fix refcount bug. Empty and 1-byte buffers are always shared. 2015-02-03 14:57:49 +02:00
Serhiy Storchaka 87d0b45485 Issue #15381: Optimized io.BytesIO to make less allocations and copyings. 2015-02-03 11:30:10 +02:00
Serhiy Storchaka 32ca3dcb97 Issue #23099: Closing io.BytesIO with exported buffer is rejected now to
prevent corrupting exported buffer.
2015-02-03 09:30:51 +02:00
Serhiy Storchaka c057c3859c Issue #23099: Closing io.BytesIO with exported buffer is rejected now to
prevent corrupting exported buffer.
2015-02-03 02:00:18 +02:00
Serhiy Storchaka 3dd3e26680 Issue #22896: Avoid to use PyObject_AsCharBuffer(), PyObject_AsReadBuffer()
and PyObject_AsWriteBuffer().
2015-02-03 01:25:42 +02:00
Serhiy Storchaka 4fdb68491e Issue #22896: Avoid to use PyObject_AsCharBuffer(), PyObject_AsReadBuffer()
and PyObject_AsWriteBuffer().
2015-02-03 01:21:08 +02:00
Benjamin Peterson 98beb7599e merge 3.4 (#23093) 2014-12-21 21:00:51 -06:00
Benjamin Peterson 10e76b67c9 allow more operations to work on detached streams (closes #23093)
Patch by Martin Panter.
2014-12-21 20:51:50 -06:00
Serhiy Storchaka 4954f9fcab Issue #17401: Output the closefd attribute as boolean. 2014-12-02 23:39:56 +02:00
Benjamin Peterson 994c7f76a3 merge 3.4 (#22849) 2014-11-12 10:23:35 -05:00
Benjamin Peterson 6c14f23100 fix possible double free in TextIOWrapper.__init__ (closes #22849) 2014-11-12 10:19:46 -05:00
Robert Collins 933430ab69 Issue #17401: document closefd in io.FileIO docs and add to repr
closefd was documented in the open docs but not the matching FileIO
class documented. Further, closefd, part of the core state for the
object was not shown.

In review it was noted that the open docs are a little confusing about
the interaction between closefd and paths, so tweaked them at the same
time.
2014-10-18 13:32:43 +13:00
Serhiy Storchaka 78184af9b5 Issue #21715: Extracted shared complicated code in the _io module to new
_PyErr_ChainExceptions() function.
2014-10-08 22:32:50 +03:00
Serhiy Storchaka e2bd2a7186 Issue #21715: Extracted shared complicated code in the _io module to new
_PyErr_ChainExceptions() function.
2014-10-08 22:31:52 +03:00
Benjamin Peterson 58ee2d31ab merge 3.4 (#22517) 2014-09-29 22:49:05 -04:00
Benjamin Peterson c44eb73473 merge 3.3 (#22517) 2014-09-29 22:48:51 -04:00
Benjamin Peterson bbd0a323ae clear BufferedRWPair weakrefs on deallocation (closes #22517) 2014-09-29 22:46:57 -04:00
Berker Peksag 43705d76aa Issue #21860: Correct docstrings of FileIO.seek() and FileIO.truncate() methods.
Patch by Terry Chia.
2014-09-24 12:44:06 +03:00
Berker Peksag b87630c273 Issue #21860: Correct docstrings of FileIO.seek() and FileIO.truncate() methods.
Patch by Terry Chia.
2014-09-24 12:43:29 +03:00
Serhiy Storchaka d8a1447c99 Issue #22215: Now ValueError is raised instead of TypeError when str or bytes
argument contains not permitted null character or byte.
2014-09-06 20:07:17 +03:00
Victor Stinner 706768c687 Issue #22156: Fix some "comparison between signed and unsigned integers"
compiler warnings in the Modules/ subdirectory.
2014-08-16 01:03:39 +02:00
Serhiy Storchaka d7728cafc5 Issue #15381: Optimized line reading in io.BytesIO. 2014-08-14 22:26:38 +03:00
Antoine Pitrou cc66a73d27 Issue #22003: When initialized from a bytes object, io.BytesIO() now
defers making a copy until it is mutated, improving performance and
memory use on some use cases.

Patch by David Wilson.
2014-07-29 19:41:11 -04:00
Benjamin Peterson e865128605 properly decref the return value of close() 2014-07-04 17:00:25 -07:00
Benjamin Peterson 4f654fbe30 properly decref the return value of close() 2014-07-04 17:00:25 -07:00
Victor Stinner 6680e9f5fd (Merge 3.4) Issue #21090: io.FileIO.readall() does not ignore I/O errors
anymore. Before, it ignored I/O errors if at least the first C call read()
succeed.
2014-07-02 23:00:38 +02:00
Victor Stinner e10920f0d1 Issue #21090: io.FileIO.readall() does not ignore I/O errors anymore. Before,
it ignored I/O errors if at least the first C call read() succeed.
2014-07-02 22:59:31 +02:00
Antoine Pitrou de68722ca0 Issue #21679: Prevent extraneous fstat() calls during open(). Patch by Bohuslav Kabrda. 2014-06-29 20:07:28 -04:00
Benjamin Peterson a96fea03e8 add BufferedIOBase.readinto1 (closes #20578)
Patch by Nikolaus Rath.
2014-06-22 14:17:44 -07:00
Victor Stinner 7d7e7756d9 Issue #10310: Use "unsigned int field:1" instead of "signed int field:1" in a
private structure of the _io module to fix a compiler warning (overflow when
assigning the value 1). Fix also a cast in
incrementalnewlinedecoder_setstate().  Patch written by Hallvard B Furuseth.
2014-06-17 23:31:25 +02:00
Serhiy Storchaka ec87a13e5d PyErr_NormalizeException doesn't like being called with an exception set
(issues #21677, #21310).
2014-06-11 07:19:39 +03:00
Serhiy Storchaka 76d3f14e01 PyErr_NormalizeException doesn't like being called with an exception set
(issues #21677, #21310).
2014-06-11 07:18:53 +03:00
Serhiy Storchaka 3a56117a60 Issue #21310: Fixed possible resource leak in failed open(). 2014-06-09 13:35:43 +03:00
Serhiy Storchaka f10063e3c3 Issue #21310: Fixed possible resource leak in failed open(). 2014-06-09 13:32:34 +03:00
Serhiy Storchaka 85e4235c0e Issue #21677: Fixed chaining nonnormalized exceptions in io close() methods. 2014-06-09 09:15:42 +03:00
Serhiy Storchaka 8a8f7f9830 Issue #21677: Fixed chaining nonnormalized exceptions in io close() methods. 2014-06-09 09:13:04 +03:00
Benjamin Peterson 4fb01ffe66 backout 0fb7789b5eeb for test breakage (#20578) 2014-06-07 23:18:12 -07:00
Benjamin Peterson 10e847bbc7 add BufferedIOBase.readinto1 (closes #20578)
Patch by Nikolaus Rath.
2014-06-07 20:06:48 -07:00
Antoine Pitrou 38ca5a7b6d Issue #21396: Fix TextIOWrapper(..., write_through=True) to not force a flush() on the underlying binary stream.
Patch by akira.
2014-05-09 00:31:32 +02:00