Serhiy Storchaka
d92d4efe3d
Issue #23573 : Restored optimization of bytes.rfind() and bytearray.rfind()
for single-byte argument on Linux.
11 years ago
Serhiy Storchaka
fa494fd883
Issue #24115 : Update uses of PyObject_IsTrue(), PyObject_Not(),
PyObject_IsInstance(), PyObject_RichCompareBool() and _PyDict_Contains()
to check for and handle errors correctly.
11 years ago
Serhiy Storchaka
8b2e8b6cce
Specify default values of semantic booleans in Argument Clinic generated signatures as booleans.
11 years ago
Gregory P. Smith
8cb6569fe1
Implements issue #9951 : Adds a hex() method to bytes, bytearray, & memoryview.
Also updates a few internal implementations of the same thing to use the
new built-in code.
Contributed by Arnon Yaari.
11 years ago
Christian Heimes
4e25913f9f
Remove local dead code. In both blocks dir is always greater 0.
11 years ago
Larry Hastings
89964c48d1
Issue #23944 : Argument Clinic now wraps long impl prototypes at column 78.
11 years ago
Serhiy Storchaka
1009bf18b3
Issue #23501 : Argumen Clinic now generates code into separate files by default.
11 years ago
Serhiy Storchaka
41525e31a5
Issue #23466 : Raised OverflowError if %c argument is out of range.
11 years ago
Serhiy Storchaka
2c7b5a9d0d
Issue #23466 : %c, %o, %x, and %X in bytes formatting now raise TypeError on
non-integer input.
11 years ago
Victor Stinner
dabbfe7b30
Issue #23573 : Fix bytes.rfind() and bytearray.rfind() on Windows
Windows has no memrchr() function.
This change is only a workaround, the optimization must be reenabled on other
platforms.
11 years ago
Serhiy Storchaka
d9d769fcdd
Issue #23573 : Increased performance of string search operations (str.find,
str.index, str.count, the in operator, str.split, str.partition) with
arguments of different kinds (UCS1, UCS2, UCS4).
11 years ago
Serhiy Storchaka
1dd49824df
Issue #23681 : The -b option now affects comparisons of bytes with int.
11 years ago
Ethan Furman
62e977f1b6
Close issue23467: add %r compatibility to bytes and bytearray
11 years ago
Antoine Pitrou
a654510150
Issue #23629 : Fix the default __sizeof__ implementation for variable-sized objects.
11 years ago
Serhiy Storchaka
26861b0b29
Issue #23450 : Fixed possible integer overflows.
11 years ago
Serhiy Storchaka
ea5ce5a15e
Issue #23383 : Cleaned up bytes formatting.
11 years ago
Serhiy Storchaka
83848704f5
Issue #22896 : Fixed using _getbuffer() in recently added _PyBytes_Format().
11 years ago
Serhiy Storchaka
4fdb68491e
Issue #22896 : Avoid to use PyObject_AsCharBuffer(), PyObject_AsReadBuffer()
and PyObject_AsWriteBuffer().
11 years ago
Victor Stinner
5474d0ba19
Issue #20284 : Fix a compilation warning on Windows
Explicitly cast the long to char.
11 years ago
Benjamin Peterson
a8efc9601d
ensure ilen is initialized when it is assigned to len
11 years ago
Ethan Furman
b95b56150f
Issue20284: Implement PEP461
11 years ago
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.
11 years ago
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.
11 years ago
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.)
11 years ago
Benjamin Peterson
d48bc9468f
these variables ought to be Py_ssize_t
11 years ago
Benjamin Peterson
42ff105539
fix overflow checking in PyBytes_Repr ( closes #22519 )
11 years ago
Serhiy Storchaka
20b39b27d9
Removed redundant casts to `char *`.
Corresponding functions now accept `const char *` (issue #1772673 ).
11 years ago
Serhiy Storchaka
d8a1447c99
Issue #22215 : Now ValueError is raised instead of TypeError when str or bytes
argument contains not permitted null character or byte.
11 years ago
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.
12 years ago
Victor Stinner
88d146b7b9
Optimize PyBytes_FromObject(): only overallocate when size=0 to not get the
empty string singleton
12 years ago
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.
12 years ago
Martin v. Löwis
0efea322a9
Rerun AC, silence pointer conversion warnings.
12 years ago
Martin v. Löwis
7252a6e81e
Issue #20179 : Apply Argument Clinic to bytes and bytearray.
Patch by Tal Einat.
12 years ago
Zachary Ware
bca9694ac1
Issue #21442 : Fix MSVC compiler warning introduced by issue21377.
12 years ago
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).
12 years ago
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.
12 years ago
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.
12 years ago
Victor Stinner
c9362cf86a
Issue #19969 : PyBytes_FromFormatV() now raises an OverflowError if "%c"
argument is not in range [0; 255].
12 years ago
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.
12 years ago
Christian Heimes
985ecdcfc2
ssue #19183 : Implement PEP 456 'secure and interchangeable hash algorithm'.
Python now uses SipHash24 on all major platforms.
12 years ago
Ezio Melotti
745d54d2fa
#17806 : Added keyword-argument support for "tabsize" to str/bytes.expandtabs().
12 years ago
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.
12 years ago
Victor Stinner
c8bc5377ac
Issue #16286 : write a new subfunction bytes_compare_eq()
* cleanup bytes_richcompare()
* PyUnicode_RichCompare(): replace a test with a XOR
12 years ago
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.
12 years ago
Serhiy Storchaka
c679227e31
Issue #1772673 : The type of `char*` arguments now changed to `const char*`.
12 years ago
Antoine Pitrou
9ed5f27266
Issue #18722 : Remove uses of the "register" keyword in C code.
13 years ago
Serhiy Storchaka
5e61f14c6d
Issue #12983 : Bytes literals with invalid \x escape now raise a SyntaxError
and a full traceback including line number.
13 years ago
Serhiy Storchaka
f458a03617
Issue #17034 : Use Py_CLEAR() in bytesobject.c.
13 years ago
Serhiy Storchaka
ace3ad3bf7
Issue #16975 : Fix error handling bug in the escape-decode bytes decoder.
13 years ago
Benjamin Peterson
5ff3f73d94
try to call __bytes__ before __index__ ( closes #16722 )
13 years ago