Commit Graph

56 Commits

Author SHA1 Message Date
Sergey Fedoseev 3e41f3cabb bpo-34488: optimize BytesIO.writelines() (GH-8904)
Avoid the creation of unused int object for each line.
2019-08-07 09:38:31 +09:00
Zackery Spytz 36dcaab7fd Fix the error handling in bytesio_sizeof(). (GH-10459)
bytesio_sizeof() must check if an error has occurred in _PySys_GetSizeOf().
2019-06-02 00:07:45 +03:00
Jeroen Demeyer 530f506ac9 bpo-36974: tp_print -> tp_vectorcall_offset and tp_reserved -> tp_as_async (GH-13464)
Automatically replace
tp_print -> tp_vectorcall_offset
tp_compare -> tp_as_async
tp_reserved -> tp_as_async
2019-05-30 19:13:39 -07:00
Serhiy Storchaka d4f9cf5545
bpo-33029: Fix signatures of getter and setter functions. (GH-10746)
Fix also return type for few other functions (clear, releasebuffer).
2018-11-27 19:34:35 +02:00
Victor Stinner bcda8f1d42
bpo-35081: Add Include/internal/pycore_object.h (GH-10640)
Move _PyObject_GC_TRACK() and _PyObject_GC_UNTRACK() from
Include/objimpl.h to Include/internal/pycore_object.h.
2018-11-21 22:27:47 +01:00
Siddhesh Poyarekar 55edd0c185 bpo-33012: Fix invalid function cast warnings with gcc 8 for METH_NOARGS. (GH-6030)
METH_NOARGS functions need only a single argument but they are cast
into a PyCFunction, which takes two arguments.  This triggers an
invalid function cast warning in gcc8 due to the argument mismatch.
Fix this by adding a dummy unused argument.
2018-04-29 21:59:33 +03:00
INADA Naoki a6296d34a4 bpo-31095: fix potential crash during GC (GH-2974) 2017-08-24 14:55:17 +09:00
Serhiy Storchaka 762bf40438 bpo-29852: Argument Clinic Py_ssize_t converter now supports None (#716)
if pass `accept={int, NoneType}`.
2017-03-30 09:15:31 +03:00
Serhiy Storchaka fff9a31a91 bpo-29865: Use PyXXX_GET_SIZE macros rather than Py_SIZE for concrete types. (#748) 2017-03-21 08:53:25 +02:00
Oren Milman 004251059b bpo-29730: replace some calls to PyNumber_Check and improve some error messages (#650) 2017-03-13 00:37:05 +02:00
orenmn 740025478d bpo-29741: Clean up C implementations of BytesIO and StringIO. (#606)
Some BytesIO methods now accept not just int subclasses but other int-like types.
2017-03-11 00:52:01 +02:00
Martin Panter ccb2c0e310 Issue #23214: Implement optional BufferedReader, BytesIO read1() argument 2016-10-20 23:48:14 +00:00
Martin Panter c249221dfd Issue #20699: Merge io bytes-like fixes from 3.5 2016-05-28 01:07:08 +00:00
Martin Panter 6bb91f3b6e Issue #20699: Document that “io” methods accept bytes-like objects
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.
2016-05-28 00:41:57 +00:00
Martin Panter 8b04a945ef Merge typo fixes from 3.5 2016-04-16 09:29:17 +00:00
Martin Panter 119e502277 Fix typos in code comments and documentation 2016-04-16 09:28:57 +00:00
Serhiy Storchaka f01e408c16 Issue #26200: Added Py_SETREF and replaced Py_XSETREF with Py_SETREF
in places where Py_DECREF was used.
2016-04-10 18:12:01 +03:00
Serhiy Storchaka ec39756960 Issue #22570: Renamed Py_SETREF to Py_XSETREF. 2016-04-06 09:50:03 +03:00
Serhiy Storchaka 48842714b9 Issue #22570: Renamed Py_SETREF to Py_XSETREF. 2016-04-06 09:45:48 +03:00
Serhiy Storchaka 1ed017ae92 Issue #20440: Cleaning up the code by using Py_SETREF and Py_CLEAR.
Old code is correct, but with Py_SETREF and Py_CLEAR it can be cleaner.
This patch doesn't fix bugs and hence there is no need to backport it.
2015-12-27 15:51:32 +02:00
Serhiy Storchaka 5a57ade58e Issue #20440: Massive replacing unsafe attribute setting code with special
macro Py_SETREF.
2015-12-24 10:35:59 +02:00
Serhiy Storchaka 5c4064e8bd Issue #25421: __sizeof__ methods of builtin types now use dynamic basic size.
This allows sys.getsize() to work correctly with their subclasses with
__slots__ defined.
2015-12-19 20:05:25 +02:00
Serhiy Storchaka 4e63f7a2b4 Issue #24989: Fixed buffer overread in BytesIO.readline() if a position is
set beyond size.  Based on patch by John Leitch.
2015-09-04 07:48:19 +03:00
Larry Hastings dbfdc380df Issue #24001: Argument Clinic converters now use accept={type}
instead of types={'type'} to specify the types the converter accepts.
2015-05-04 06:59:46 -07:00
Serhiy Storchaka f24131ff31 Issue #20175: Converted the _io module to Argument Clinic. 2015-04-16 11:19:43 +03:00
Serhiy Storchaka 5056769b36 Replaced "string" with "bytes object" in docstrings of binary I/O objects. 2015-04-10 02:19:57 +03:00
Serhiy Storchaka b817b77a8c Replaced "string" with "bytes object" in docstrings of binary I/O objects. 2015-04-10 02:18:44 +03: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
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
Stefan Krah ea94ba45fa Merge 3.2. 2012-09-08 11:19:27 +02:00
Stefan Krah 96efdd422c Issue #15868: Fix refleak in bytesio.c (Coverity #715365). 2012-09-08 11:12:33 +02:00
Antoine Pitrou 11946fbe80 Issue #15841: The readable(), writable() and seekable() methods of BytesIO
and StringIO objects now raise ValueError when the object has been closed.
Patch by Alessandro Moura.
2012-09-05 20:13:48 +02:00
Antoine Pitrou 1d857453b7 Issue #15841: The readable(), writable() and seekable() methods of BytesIO
and StringIO objects now raise ValueError when the object has been closed.
Patch by Alessandro Moura.
2012-09-05 20:11:49 +02:00
Antoine Pitrou 57911f6c1a Issue #15489: Add a __sizeof__ implementation for BytesIO objects.
Patch by Serhiy Storchaka.
2012-07-30 00:01:44 +02:00
Antoine Pitrou 8f328d0c1d Issue #15489: Add a __sizeof__ implementation for BytesIO objects.
Patch by Serhiy Storchaka.
2012-07-30 00:01:06 +02:00
Brett Cannon b94767ff44 Issue #8914: fix various warnings from the Clang static analyzer v254. 2011-02-22 20:15:44 +00:00
Benjamin Peterson fa73555cfc correct logic when pos is after the string #10467 2010-11-20 17:24:04 +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 d5c3f6c839 BytesIO.getvalue() and StringIO.getvalue() are METH_NOARGS. 2010-09-02 19:48:07 +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
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