Serhiy Storchaka
604e74c6be
bpo-20552: Use specific asserts in bytes tests ( #790 )
2017-03-27 12:59:07 +02:00
Xiang Zhang
b76ad5121e
bpo-29714: Fix a regression that bytes format may fail when containing zero bytes inside. (GH-499)
2017-03-06 17:17:05 +08:00
INADA Naoki
7ed28a8914
Merge 3.6
2017-01-06 17:44:43 +09:00
INADA Naoki
a634e23209
Issue #29159 : Fix regression in bytes(x) when x.__index__() raises Exception.
2017-01-06 17:32:01 +09:00
Serhiy Storchaka
dd1da7f74a
Issue #28927 : bytes.fromhex() and bytearray.fromhex() now ignore all ASCII
...
whitespace, not only spaces. Patch by Robert Xiao.
2016-12-19 18:51:37 +02:00
Serhiy Storchaka
7984bff52a
Issue #28385 : An error message when non-empty format spec is passed to
...
object.__format__ now contains the name of actual type.
2016-10-30 19:37:46 +02:00
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.
2016-10-30 19:33:54 +02:00
Serhiy Storchaka
c49a516ae9
Remove old typo.
...
Initially (e0b7e34b5971) it should be \udef0, but after 52a77ef069cd
(issue #3672 ) lone surrogates are not accepted and should be removed.
2016-09-08 15:47:27 +03:00
Martin Panter
1b6c6da85d
Issue #27506 : Support bytes/bytearray.translate() delete as keyword argument
...
Patch by Xiang Zhang.
2016-08-27 08:35:02 +00:00
Guido van Rossum
97c1adf393
Anti-registration of various ABC methods.
...
- Issue #25958 : Support "anti-registration" of special methods from
various ABCs, like __hash__, __iter__ or __len__. All these (and
several more) can be set to None in an implementation class and the
behavior will be as if the method is not defined at all.
(Previously, this mechanism existed only for __hash__, to make
mutable classes unhashable.) Code contributed by Andrew Barnert and
Ivan Levkivskyi.
2016-08-18 09:22:23 -07:00
Serhiy Storchaka
f9efb8b18b
Issue #27474 : Unified error messages in the __contains__ method of bytes and
...
bytearray for integers in and out of the Py_ssize_t range.
Patch by Xiang Zhang.
2016-07-10 12:37:30 +03:00
Serhiy Storchaka
6c94d10a19
Issue #27443 : __length_hint__() of bytearray itearator no longer return
...
negative integer for resized bytearray.
2016-07-03 14:42:17 +03:00
Serhiy Storchaka
af65872da2
Issue #27443 : __length_hint__() of bytearray itearator no longer return
...
negative integer for resized bytearray.
2016-07-03 14:41:36 +03:00
Serhiy Storchaka
0855e706aa
Issue #27007 : The fromhex() class methods of bytes and bytearray subclasses
...
now return an instance of corresponding subclass.
2016-07-01 17:22:31 +03:00
Serhiy Storchaka
4b23494ded
Issue #27039 : Fixed bytearray.remove() for values greater than 127.
...
Based on patch by Joe Jevnik.
2016-05-16 22:24:03 +03:00
Serhiy Storchaka
7bf36dace8
Issue #27039 : Fixed bytearray.remove() for values greater than 127.
...
Patch by Joe Jevnik.
2016-05-16 22:15:38 +03:00
Serhiy Storchaka
e78592d42c
Make bytes and bytearray subclass tests compatible with base types tests.
2016-05-12 12:33:21 +03:00
Serhiy Storchaka
3fa86a0612
Make bytes and bytearray subclass tests compatible with base types tests.
2016-05-12 12:33:41 +03:00
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.
2016-04-15 17:52:27 +02:00
Serhiy Storchaka
c9a59e6e4f
Issue #26764 : Fixed SystemError in bytes.__rmod__.
2016-04-15 14:11:10 +03:00
Martin Panter
cfff15d274
Issue #26712 : Merge string_tests cleanup from 3.5
2016-04-10 09:16:23 +00:00
Martin Panter
0d0db6cc1e
Issue #26712 : Unify (r)split, (l/r)strip tests into string_tests
...
This eliminates a few redundant test cases.
2016-04-10 08:45:26 +00:00
Serhiy Storchaka
3c149a6832
Issue #26764 : Bacported tests for bytes formatting.
2016-04-15 14:13:37 +03:00
Martin Panter
747be0805d
Issue #26257 : Merge buffer_tests cleanup from 3.5
2016-04-08 00:16:33 +00:00
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.
2016-04-06 06:37:17 +00:00
Serhiy Storchaka
f39c0ac62f
Issue #26492 : Added additional tests for exhausted iterators of mutable sequences.
2016-03-30 21:01:45 +03:00
Serhiy Storchaka
8dc2ec1513
Issue #26492 : Added additional tests for exhausted iterators of mutable sequences.
2016-03-30 21:01:26 +03:00
Serhiy Storchaka
ab479c49d3
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.
2016-03-30 20:41:15 +03:00
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.
2016-03-30 20:40:02 +03:00
Serhiy Storchaka
de128e19e2
Issue #26015 : Added new tests for pickling iterators of mutable sequences.
2016-03-06 14:12:04 +02:00
Serhiy Storchaka
aabafe7bc2
Issue #26015 : Added new tests for pickling iterators of mutable sequences.
2016-03-06 14:10:24 +02:00
Martin Panter
7909411964
Issue #19587 : Merge test_bytes cleanup from 3.5
2016-02-02 10:54:10 +00:00
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
2016-02-02 10:37:15 +00:00
Serhiy Storchaka
3182db356c
Issue #25766 : Special method __bytes__() now works in str subclasses.
2015-12-20 16:37:21 +02:00
Serhiy Storchaka
5aac3ed799
Issue #25766 : Special method __bytes__() now works in str subclasses.
2015-12-20 16:36:34 +02:00
Serhiy Storchaka
bb6e4a0b31
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.
2015-11-25 15:53:19 +02:00
Serhiy Storchaka
f9afda57ad
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.
2015-11-25 15:52:04 +02:00
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.
2015-11-25 15:47:01 +02:00
Victor Stinner
83ff8a6832
test_bytes: new try to fix test on '%p' formatter on Windows
2015-10-14 15:28:59 +02:00
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
2015-10-14 11:25:33 +02:00
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.
2015-10-14 02:55:12 +02:00
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
2015-10-14 00:21:35 +02:00
Serhiy Storchaka
bc9e75ed02
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.
2015-06-29 21:18:01 +03:00
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.
2015-06-29 21:14:06 +03:00
Antoine Pitrou
ef64847f71
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.
2015-05-19 20:55:42 +02:00
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.
2015-05-19 20:52:27 +02:00
Gregory P. Smith
32d34bcf1d
Use assertEqual rather than assertEquals to avoid the deprecation warning.
2015-04-26 05:05:53 +00:00
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.
2015-04-25 23:22:26 +00:00
Serhiy Storchaka
1dd49824df
Issue #23681 : The -b option now affects comparisons of bytes with int.
2015-03-20 16:54:57 +02: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