Serhiy Storchaka
d1af5effc2
Issue #28385 : An error message when non-empty format spec is passed to
object.__format__ now contains the name of actual type.
10 years ago
Serhiy Storchaka
af65872da2
Issue #27443 : __length_hint__() of bytearray itearator no longer return
negative integer for resized bytearray.
10 years ago
Serhiy Storchaka
7bf36dace8
Issue #27039 : Fixed bytearray.remove() for values greater than 127.
Patch by Joe Jevnik.
10 years ago
Serhiy Storchaka
e78592d42c
Make bytes and bytearray subclass tests compatible with base types tests.
10 years ago
Victor Stinner
e914d41312
Issue #26766 : Fix _PyBytesWriter_Finish()
Return a bytearray object when bytearray is requested and when the small buffer
is used.
Fix also test_bytes: bytearray%args must return a bytearray type.
10 years ago
Serhiy Storchaka
3c149a6832
Issue #26764 : Bacported tests for bytes formatting.
10 years ago
Serhiy Storchaka
c9a59e6e4f
Issue #26764 : Fixed SystemError in bytes.__rmod__.
10 years ago
Martin Panter
0d0db6cc1e
Issue #26712 : Unify (r)split, (l/r)strip tests into string_tests
This eliminates a few redundant test cases.
10 years ago
Martin Panter
152a19c6bd
Issue #26257 : Eliminate buffer_tests.py and fix ByteArrayAsStringTest
ByteArrayAsStringTest.fixtype() was converting test data to bytes, not byte-
array, therefore many of the test cases inherited in this class were not
actually being run on the bytearray type.
The tests in buffer_tests.py were redundant with methods in string_tests
.MixinStrUnicodeUserStringTest and string_tests.CommonTest. These methods are
now moved into string_tests.BaseTest, where they will also get run for bytes
and bytearray.
This change also moves test_additional_split(), test_additional_rsplit(), and
test_strip() from CommonTest to BaseTest, meaning these tests are now run for
bytes and bytearray. I plan to eliminate redundancies with existing tests in
test_bytes.py soon.
10 years ago
Serhiy Storchaka
8dc2ec1513
Issue #26492 : Added additional tests for exhausted iterators of mutable sequences.
10 years ago
Serhiy Storchaka
fbb1c5ee06
Issue #26494 : Fixed crash on iterating exhausting iterators.
Affected classes are generic sequence iterators, iterators of str, bytes,
bytearray, list, tuple, set, frozenset, dict, OrderedDict, corresponding
views and os.scandir() iterator.
10 years ago
Serhiy Storchaka
aabafe7bc2
Issue #26015 : Added new tests for pickling iterators of mutable sequences.
11 years ago
Martin Panter
275bd96aa6
Issue #19587 : Remove masked and redundant tests in test_bytes
* test_contains() did not override anything
* test_expandtabs/upper/lower() in FixedStringTest were masking usable tests
in string_tests. These tests now get run for bytearray() and bytes().
* test_expandtabs/upper/lower() in buffer_tests were only run on bytearray()
and are redundant with string_tests
11 years ago
Serhiy Storchaka
5aac3ed799
Issue #25766 : Special method __bytes__() now works in str subclasses.
11 years ago
Serhiy Storchaka
15095800a3
Issue #24731 : Fixed crash on converting objects with special methods
__bytes__, __trunc__, and __float__ returning instances of subclasses of
bytes, int, and float to subclasses of bytes, int, and float correspondingly.
11 years ago
Victor Stinner
83ff8a6832
test_bytes: new try to fix test on '%p' formatter on Windows
11 years ago
Victor Stinner
2bf8993db9
Optimize bytes.fromhex() and bytearray.fromhex()
Issue #25401 : Optimize bytes.fromhex() and bytearray.fromhex(): they are now
between 2x and 3.5x faster. Changes:
* Use a fast-path working on a char* string for ASCII string
* Use a slow-path for non-ASCII string
* Replace slow hex_digit_to_int() function with a O(1) lookup in
_PyLong_DigitValue precomputed table
* Use _PyBytesWriter API to handle the buffer
* Add unit tests to check the error position in error messages
11 years ago
Victor Stinner
7ab986dd84
Fix test_bytes on Windows
On Windows, sprintf("%p", 0xabcdef) formats hexadecimal in uppercase and pad to
16 characters (on 64-bit system) with zeros.
11 years ago
Victor Stinner
03dab786b2
Rewrite PyBytes_FromFormatV() using _PyBytesWriter API
* Add much more unit tests on PyBytes_FromFormatV()
* Remove the first loop to compute the length of the output string
* Use _PyBytesWriter to handle the bytes buffer, use overallocation
* Cleanup the code to make simpler and easier to review
11 years ago
Serhiy Storchaka
7b6e3b91f5
Issue #24467 : Fixed possible buffer over-read in bytearray. The bytearray
object now always allocates place for trailing null byte and it's buffer now
is always null-terminated.
11 years ago
Antoine Pitrou
2545411e28
Issue #23985 : Fix a possible buffer overrun when deleting a slice from the front of a bytearray and then appending some other bytes data.
Patch by Martin Panter.
11 years ago
Gregory P. Smith
32d34bcf1d
Use assertEqual rather than assertEquals to avoid the deprecation warning.
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
Serhiy Storchaka
1dd49824df
Issue #23681 : The -b option now affects comparisons of bytes with int.
11 years ago
Stefan Krah
650c1e818d
Issue #14203 : Remove obsolete support for view==NULL in bytesiobuf_getbuffer()
and array_buffer_getbuf().
12 years ago
Serhiy Storchaka
4e1942bcd8
Don't use deprecated assertEquals.
12 years ago
Ethan Furman
b95b56150f
Issue20284: Implement PEP461
12 years ago
Serhiy Storchaka
bad1257c96
Issue #22777 : Test pickling with all protocols.
12 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.
12 years ago
Antoine Pitrou
cc23154d02
Issue #22335 : Fix crash when trying to enlarge a bytearray to 0x7fffffff bytes on a 32-bit platform.
12 years ago
Benjamin Peterson
c31f12d196
check that exception messages are not empty ( #22379 )
Patch by Yongzhi Pan.
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
Victor Stinner
7611964b2c
Fix test_bytes when sys.stdin is None, for example on Windows when using
pythonw.exe instead of python.exe
12 years ago
Victor Stinner
c9362cf86a
Issue #19969 : PyBytes_FromFormatV() now raises an OverflowError if "%c"
argument is not in range [0; 255].
13 years ago
Antoine Pitrou
5df8a8a1fd
Issue #19087 : Improve bytearray allocation in order to allow cheap popping of data at the front (slice deletion).
13 years ago
Serhiy Storchaka
9d0add0c7e
Issue #17041 : Fix testing when Python is configured with the
--without-doc-strings.
14 years ago
Stefan Krah
4216aa1e52
Adapt test for build --without-doc-strings.
14 years ago
Stefan Krah
6e572b8b2e
Adapt test_bytes for a build --without-doc-strings.
14 years ago
Ezio Melotti
0dceb560b6
#16910 : test_bytes, test_unicode, and test_userstring now work with unittest test discovery. Patch by Zachary Ware.
14 years ago
Andrew Svetlov
8b33dd8e54
Use OESeeror instead of os.error ( #16720 )
Patch by Serhiy Storchaka.
14 years ago
Benjamin Peterson
5ff3f73d94
try to call __bytes__ before __index__ ( closes #16722 )
14 years ago
Ezio Melotti
c64bcbec4b
#8401 : assigning an int to a bytearray slice (e.g. b[3:4] = 5) now raises an error.
14 years ago
Ezio Melotti
67dc4a87fc
#8401 : assigning an int to a bytearray slice (e.g. b[3:4] = 5) now raises an error.
14 years ago
Antoine Pitrou
cfc22b4a9b
Issue #15958 : bytes.join and bytearray.join now accept arbitrary buffer objects.
14 years ago
Kristján Valur Jónsson
31668b8f7a
Issue #14288 : Serialization support for builtin iterators.
14 years ago
Ezio Melotti
cda6b6d60d
#14081 : The sep and maxsplit parameter to str.split, bytes.split, and bytearray.split may now be passed as keyword arguments.
15 years ago
Victor Stinner
f8eac00779
Issue #13623 : Fix a performance regression introduced by issue #12170 in
bytes.find() and handle correctly OverflowError (raise the same ValueError than
the error for -1).
15 years ago
Antoine Pitrou
ac65d96777
Issue #12170 : The count(), find(), rfind(), index() and rindex() methods
of bytes and bytearray objects now accept an integer between 0 and 255
as their first argument. Patch by Petri Lehtinen.
15 years ago
Eli Bendersky
906b88fb2a
Issue #12380 : PyArg_ParseTuple now accepts a bytearray for the 'c' format.
As a side effect, this now allows the rjust, ljust and center methods of
bytes and bytearray to accept a bytearray argument.
Patch by Petri Lehtinen
15 years ago
Ezio Melotti
ba42fd5801
#6780 : fix starts/endswith error message to mention that tuples are accepted too.
15 years ago