Commit Graph

219 Commits

Author SHA1 Message Date
Antoine Pitrou 63afdaa110 Issue #23629: Fix the default __sizeof__ implementation for variable-sized objects. 2015-03-10 22:35:24 +01:00
Antoine Pitrou a654510150 Issue #23629: Fix the default __sizeof__ implementation for variable-sized objects. 2015-03-10 22:32:00 +01:00
Serhiy Storchaka 26861b0b29 Issue #23450: Fixed possible integer overflows. 2015-02-16 20:52:17 +02:00
Serhiy Storchaka ea5ce5a15e Issue #23383: Cleaned up bytes formatting. 2015-02-10 23:23:12 +02:00
Serhiy Storchaka 83848704f5 Issue #22896: Fixed using _getbuffer() in recently added _PyBytes_Format(). 2015-02-03 01:49: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 5474d0ba19 Issue #20284: Fix a compilation warning on Windows
Explicitly cast the long to char.
2015-01-26 16:43:36 +01:00
Benjamin Peterson a8efc9601d ensure ilen is initialized when it is assigned to len 2015-01-26 09:23:41 -05:00
Ethan Furman b95b56150f Issue20284: Implement PEP461 2015-01-23 20:05:18 -08:00
Serhiy Storchaka 83cf99d733 Issue #20335: bytes constructor now raises TypeError when encoding or errors
is specified with non-string argument.  Based on patch by Renaud Blanch.
2014-12-02 09:24:06 +02:00
Serhiy Storchaka 0b2cacb42a Issue #20335: bytes constructor now raises TypeError when encoding or errors
is specified with non-string argument.  Based on patch by Renaud Blanch.
2014-12-02 09:26:14 +02:00
Larry Hastings dfbeb160de Issue #22615: Argument Clinic now supports the "type" argument for the
int converter.  This permits using the int converter with enums and
typedefs.
2014-10-13 10:39:41 +01:00
R David Murray 861470c836 #16518: Bring error messages in harmony with docs ("bytes-like object")
Some time ago we changed the docs to consistently use the term 'bytes-like
object' in all the contexts where bytes, bytearray, memoryview, etc are used.
This patch (by Ezio Melotti) completes that work by changing the error
messages that previously reported that certain types did "not support the
buffer interface" to instead say that a bytes-like object is required.  (The
glossary entry for bytes-like object references the discussion of the buffer
protocol in the docs.)
2014-10-05 11:47:01 -04:00
Benjamin Peterson cdfb7691dd merge 3.4 2014-09-29 19:12:44 -04:00
Benjamin Peterson c2cfa8ddd8 merge 3.3 2014-09-29 19:12:37 -04:00
Benjamin Peterson d48bc9468f these variables ought to be Py_ssize_t 2014-09-29 19:12:26 -04:00
Benjamin Peterson 36a24f3f43 merge 3.4 (#22519) 2014-09-29 19:11:05 -04:00
Benjamin Peterson 18f836fb65 merge 3.3 (closes #22519) 2014-09-29 19:09:49 -04:00
Benjamin Peterson 42ff105539 fix overflow checking in PyBytes_Repr (closes #22519) 2014-09-29 19:01:18 -04:00
Serhiy Storchaka 20b39b27d9 Removed redundant casts to `char *`.
Corresponding functions now accept `const char *` (issue #1772673).
2014-09-28 11:27:24 +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 049e509a9f Issue #22207: Fix "comparison between signed and unsigned integers" warning in
test checking for integer overflow on Py_ssize_t type: cast explicitly to
size_t.
2014-08-17 22:20:00 +02:00
Victor Stinner 88d146b7b9 Optimize PyBytes_FromObject(): only overallocate when size=0 to not get the
empty string singleton
2014-08-17 21:12:18 +02:00
Terry Jan Reedy ffff1440d1 Issue #22077: Improve index error messages for bytearrays, bytes, lists, and
tuples by adding 'or slices'. Added ', not <typename' for bytearrays.
Original patch by Claudiu Popa.
2014-08-02 01:30:37 -04:00
Martin v. Löwis 0efea322a9 Rerun AC, silence pointer conversion warnings. 2014-07-27 17:29:17 +02:00
Martin v. Löwis 7252a6e81e Issue #20179: Apply Argument Clinic to bytes and bytearray.
Patch by Tal Einat.
2014-07-27 16:25:09 +02:00
Zachary Ware bca9694ac1 Issue #21442: Fix MSVC compiler warning introduced by issue21377. 2014-05-06 11:42:37 -05:00
Victor Stinner db067af12a Issue #21233: Add new C functions: PyMem_RawCalloc(), PyMem_Calloc(),
PyObject_Calloc(), _PyObject_GC_Calloc(). bytes(int) and bytearray(int) are now
using ``calloc()`` instead of ``malloc()`` for large objects which is faster
and use less memory (until the bytearray buffer is filled with data).
2014-05-02 22:31:14 +02:00
Antoine Pitrou 161d695fb0 Issue #21377: PyBytes_Concat() now tries to concatenate in-place when the first argument has a reference count of 1.
Patch by Nikolaus Rath.
2014-05-01 14:36:20 +02:00
Kristján Valur Jónsson 25dded041f Make the various iterators' "setstate" sliently and consistently clip the
index.  This avoids the possibility of setting an iterator to an invalid
state.
2014-03-05 13:47:57 +00:00
Kristján Valur Jónsson c5cc5011ac Make the various iterators' "setstate" sliently and consistently clip the
index.  This avoids the possibility of setting an iterator to an invalid
state.
2014-03-05 15:23:07 +00:00
Victor Stinner 507ac3a591 (Merge 3.3) Issue #19969: PyBytes_FromFormatV() now raises an OverflowError if
"%c" argument is not in range [0; 255].
2013-12-13 12:15:31 +01:00
Victor Stinner c9362cf86a Issue #19969: PyBytes_FromFormatV() now raises an OverflowError if "%c"
argument is not in range [0; 255].
2013-12-13 12:14:44 +01:00
Christian Heimes d3afe781b1 Silence expression result unused warnings with clang.
The PyObject_INIT() macros returns obj:

../cpython/Objects/methodobject.c:32:23: warning: expression result unused [-Wunused-value]
        PyObject_INIT(op, &PyCFunction_Type);
                      ^~
../cpython/Include/objimpl.h:139:69: note: expanded from macro 'PyObject_INIT'
    ( Py_TYPE(op) = (typeobj), _Py_NewReference((PyObject *)(op)), (op) )
                                                                    ^
1 warning generated.
2013-12-04 09:27:47 +01:00
Christian Heimes 985ecdcfc2 ssue #19183: Implement PEP 456 'secure and interchangeable hash algorithm'.
Python now uses SipHash24 on all major platforms.
2013-11-20 11:46:18 +01:00
Ezio Melotti 745d54d2fa #17806: Added keyword-argument support for "tabsize" to str/bytes.expandtabs(). 2013-11-16 19:10:57 +02:00
Victor Stinner fd9e44db37 Issue #16286: optimize PyUnicode_RichCompare() for identical strings (same
pointer) for any operator, not only Py_EQ and Py_NE.

Code of bytes_richcompare() and PyUnicode_RichCompare() is now closer.
2013-11-04 11:23:05 +01:00
Victor Stinner c8bc5377ac Issue #16286: write a new subfunction bytes_compare_eq()
* cleanup bytes_richcompare()
* PyUnicode_RichCompare(): replace a test with a XOR
2013-11-04 11:08:10 +01:00
Victor Stinner 986e224d5a Issue #18408: Fix error handling in PyBytes_FromObject()
_PyBytes_Resize(&new) sets new to NULL on error, don't call Py_DECREF() with NULL.
2013-10-29 03:14:22 +01:00
Serhiy Storchaka c679227e31 Issue #1772673: The type of `char*` arguments now changed to `const char*`. 2013-10-19 21:03:34 +03:00
Antoine Pitrou 9ed5f27266 Issue #18722: Remove uses of the "register" keyword in C code. 2013-08-13 20:18:52 +02:00
Serhiy Storchaka b8cbba5877 Issue #12983: Bytes literals with invalid \x escape now raise a SyntaxError
and a full traceback including line number.
2013-02-10 17:43:25 +02:00
Serhiy Storchaka 801d955f04 Issue #12983: Bytes literals with invalid \x escape now raise a SyntaxError
and a full traceback including line number.
2013-02-10 17:42:01 +02:00
Serhiy Storchaka 5e61f14c6d Issue #12983: Bytes literals with invalid \x escape now raise a SyntaxError
and a full traceback including line number.
2013-02-10 17:36:00 +02:00
Serhiy Storchaka 8911ef5b6d Issue #17034: Use Py_CLEAR() in bytesobject.c. 2013-02-02 18:46:19 +02:00
Serhiy Storchaka d357a3f841 Issue #17034: Use Py_CLEAR() in bytesobject.c. 2013-02-02 18:45:54 +02:00
Serhiy Storchaka f458a03617 Issue #17034: Use Py_CLEAR() in bytesobject.c. 2013-02-02 18:45:22 +02:00
Serhiy Storchaka f584aba3a5 Issue #16975: Fix error handling bug in the escape-decode bytes decoder. 2013-01-25 23:33:22 +02:00
Serhiy Storchaka e58785b200 Issue #16975: Fix error handling bug in the escape-decode bytes decoder. 2013-01-25 23:32:41 +02:00